TrFile_GetIcon |
Gets the icon of a file and returns it as a PNG image.
Syntax
TrFile_GetIcon ( switches ; filePath ; {iconName} )
Parameters
switches | these determine the properties of the image that is returned |
filePath | the path to the file from which to get the icon |
iconName | (optional) the (internal) name of the created PNG image |
Switches
Switches can be empty or one or more of the following:
-Size=64 | (default) maximum size of the height or width is 64 pixels |
-Size=128 | maximum size of the height or width is 128 pixels |
-Size=256 | maximum size of the height or width is 256 pixels |
You can also add these switches:
-RetinaResolution | create icons with double resolution (144 dpi), ideal for displaying on retina screens |
Returned Result
Data type returned
Container
Result
The returned result is a PNG thumbnail of the icon. If an error occurs an error code is returned. An error always starts with 2 dollars, followed by the error code. You should always check for errors. Returned error codes can be:
$$-2003 | cantFindHandler | No icon could be created |
Other errors may be returned.
Originated in
Troi File Plug-in 8.6
Compatibility
FileMaker Pro 17 to FileMaker Pro 21 (2024)
Considerations
The optional iconName is added to the created image data and also when the image is stored in the container. This name is normally not visible, but will be used for example when you perform an Export Field Contents action later.
You can also use FileMaker styled paths, like “filemac:/MacHD/folder/myData.doc”.
Example
Set Field [ container field ; TrFile_GetIcon ( "-Unused" ; "Mac HD:sample.pdf" ) ]
This will create a PNG thumbnail image of the icon of the PDF file and put it in a container field.
Used in example file
Thumbnail.fmp12
Related function
TrFile_CreateThumbnail |
Related topics
Troi File Plug-in online help (overview)