BE_ConvertContainer

BE_ConvertContainer ( field {; type ; width ; height } )

This is to convert container field contents between the internal FileMaker "image" format and the internal "file" format. So you can do insert from file, but then convert that to an image that will display instead of just seeing the file icon.

Version : 3.1

Parameters : 

field : a container field with a file or image in it.
type : either blank for a type of "file" or from the list below.
width : the width if you're converting to an image.
height : the height if you're converting to an image.


Result : The converted container field data.  Errors can be captured in BE_GetLastError, which will be 0 for success.

Notes :

This is not an image conversion function.  It only converts between the two container formats, of file and image.  So you can't use it to change the format of the contents of an email from PDF to JPEG for example.  When going from file to image, FileMaker needs to be told what sort of image it is, and that's what you need to pass in the parameters.

You would use this function when you have a image file stored in a container that is showing as a file, rather than a picture.  You use this function to alter the internal storage option to image so that it will display a preview.

 

Use this function with a Set Field script step to convert from a container field stored as a file into a container image or vice versa.  It can be used to set into the same field as the one referenced in the function parameter.

1. If only the field is supplied then it is converted to “FILE”
2. If “ZLIB” is supplied the file is compressed
3. Other known formats are:
- “snd “ *
- “JPEG”
- “GIFf" *
- "EPS “ *
- “META" *
- "PNGf"
- “BMPf" *
- "PDF "

* = not tested.

If the width and height are not supplied FM appears to display the image correctly but GetWidth and GetHeight return 0. However, GetContainerAttribute ( Test::Data ; "width" ) and GetContainerAttribute ( Test::Data ; "height” ) with both return the correct value so running the following

BE_ConvertContainer ( Test::File ; "JPEG" ; GetContainerAttribute ( Test::Data ; "width" ) ; GetContainerAttribute ( Test::Data ; "height" ) )

twice from a script will get things set correctly. ( in other words you have a file, insert it as an image with no sizes, then get FMP to tell you the sizes, then insert it again with those sizes, and it will display properly. )

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.