Media_TApply ( container )
Media_TApply applies any currently defined transformations (Media_TRotate, Media_TScale, Media_TSkew, Media_TCrop, Media_TQuad) to the specified image.
Parameter | Description |
---|---|
container | The location of the source image. |
The container parameter can be:
- a container field
- file path
- text field with a file path
- image URL
- a function or calculation that results in an image
To clear transformation settings, use the Media_TClear function.
Inserting Images with Media_TApply
Because the Media_TApply parameter can also be the location of an external image file, you can apply current transformations to the image in that file and place the resulting image into a FileMaker container field. This, in effect, allows you to sidestep the need for a separate process to insert images. If you don’t want to actually modify the image before inserting it in this fashion, you can first call the Media_TClear function so the subsequent Media_TApply step does nothing but place the image into the result container.
Transformation Order
If Media_TCrop is one of the transformations defined, the source image will be cropped before other transformations are applied. Media_TQuad is next in priority. When you have several transformations defined at the same time, the will be applied in the order of crop, quad, then other transformations.
Returns
An MMIM image with preview (see the explanation of image formats above).
Examples
To take an image from a container field named “Picture 1”, rotate it 90 degrees clockwise and place the result into a container named “Picture Result”:
Set Field [ MyTable::Response; Media_TClear ]
Set Field [ MyTable::Response; Media_TRotate ( 90 ) ]
Set Field [ MyTable::Picture Result;
Media_TApply ( MyTable::Picture 1 ) ]
To crop and rotate an image at the same time:
Set Field [ MyTable::Response; Media_TClear ]
Set Field [ MyTable::Response;
Media_TCrop ( 45; 35; 135; 145 ) ]
Set Field [ MyTable::Response; Media_TRotate ( 90 ) ]
Set Field [ MyTable::Picture Result;
Media_TApply ( MyTable::Picture 1 ) ]
To insert a picture into a container field from an external image file using the file path and file name:
Set Field [ MyTable::Response ; Media_TClear ]
Set Field [ MyTable::Picture ;
Media_TApply ( “.D/Images/golden.bmp” ) ]
To flip an image upside down as you insert it from an external image file:
Set Field [ MyTable::Response ; Media_TClear ]
Set Field [ MyTable::Response ;
Media_TScale ( -1 ; 1 ) ]
Set Field [ MyTable::Picture ;
Media_TApply ( MyTable::File Location ) ]