Skip to main content

TrFile_GetIcon (function reference)

Troi File Plug-in for FileMaker Pro

TrFile_GetIcon

Gets the icon of a file and returns it as a PNG image.

SyntaxFunction badge

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 16 to FileMaker Pro 2023

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 functionFunction badge

TrFile_CreateThumbnail

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 16 to 2023 –> TrFile_GetIcon (filep4307) 2023-0601 15:36:04