Recently I was asked whether it is possible to rotate an image in a FileMaker container field. As far as I know this only is possible by exporting the image, using another application to rotate the image, and then re-importing it back into FileMaker. This solution would exist only in a Mac OS X environment, so I turned to AppleScript, and the built-in image manipulation app called Image Events.
Although I am sure refinements can be made to the process, and it currently only works on the Mac OS, the process is fairly straightforward. The file has a container field which stores an image. Another field stores the temporary path for each record’s image. I decided to capture the direction of the rotation (clockwise or counter-clockwise) as a script parameter and set up some basic buttons to handle the process for the demo. To rotate clockwise the angle is 90 degrees, while for counter-clockwise it’s 270 degrees.

Since the AppleScript uses the database name and layout name, I captured these as variables. I also set the AppleScript itself as a variable so I could step through the script and see what it generated. I then built the path for the export, and also converted the slashes to colons for the AppleScript path. Immediately after exporting the image, I ran it through the Image Events to rotate it, and then followed this up with an insert image script step, grabbing the rotated image from its Finder location. I added a platform check so this would run only on the Mac.

There are at least two plug-ins that accomplish very similar goals. 360Works’s free ScriptMaster rotates an image based on a URL, so if this image resides in a container field you first will need to export the image, apply the rotation with the ScriptMaster function, and import the modified image. CNS Image will actually rotate an image inside a container field, and has many other useful features; prices can be found at the CNS web site. Both plug-ins are cross-platform, unlike the AppleScript solution outlined here.
Sample File: ImageRotator.fp7
