Jump to content

controlling iPhoto with Filemaker


This topic is 6068 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I am a doctor and have written a simple Filemaker database that stores patient information. I keep the patient's xrays in iPhoto because I need to zoom, pan and rotate the images when I look at them. Is there a way to open a patient's xrays in iPhoto by clicking on a link in the patient's Filemaker record?

Thanks for your help!

Andreas

Link to comment
Share on other sites

While iPhoto has substantial applescript implementation, and Filemaker can perform applescript based on values or calc's in the current record. Would I say resizing isn't the toughest task at hand. Image events can do the same with much less overhead, say put a certain cropping and resize into another containerfield.

I say this because you are likely to spend some time digesting the iPhoto library, and make it march to the beat of your drum. While imageevents/SIPS are pretty easy to script:

Although this is meant to be a droplet, could it easily be an embedded applescript instead:

http://www.macosxhints.com/article.php?story=2004092804461334&query=resize%2Bphoto

--sd

Link to comment
Share on other sites

Yes, if you've stored the image in FileMaker [x] Store only a reference to the file, you have the full file path to the file. You can see it with the calculation, result text, GetAsText ( container field ). It will be 3 lines, the image dimensions, a relative path, and an absolute path (path's in FileMaker syntax).

But it's even simpler with AppleScript, which by default sees the Mac syntax file path to an image stored as reference (can also set the image from a file path). When run in a Perform AppleScript script step, this AppleScript will open an image file in whatever application is considered to be the owner of the file. If you need to specify iPhoto, just put "iPhoto" instead of "Finder"

tell current record

try

set m to cell "theImage"

tell application "Finder" to open m

end try

end tell

How you get the images into FileMaker as references is a whole 'nother story. There are a few possiblilities. One possiblility is to create a well-known hierarchal folder structure for your images. Then you don't even need to insert the pictures. You can create a calculation, which, once given the file name, can show the image. Using AppleScript you can "list folder" to get the image file names of a known folder.

It is also possible to use FileMaker's Import Folder command, to import from a folder (and its subfolders). This would work if the file names are unique. But, if you have lots (thousands) of pictures, it can be pretty slow.

There are other methods. A while ago someone asked a question here about importing from an iPhoto library using Import XML. iPhoto stores all the file paths to its images in an xml file, AlbumData.xml (at least mine is), in its folder, which is usually in the Pictures folder. To see if yours is, try this AppleScript:

set thePicts to path to pictures folder as string

set iPhotoFolder to thePicts & "iPhoto Library:"

tell application "Finder" to open alias iPhotoFolder

But, anyway, wherever the xml file is, you can read it, and even import all its picture paths, using an xsl stylesheet.

The section of xml where the image path is looks like this (though you also have to know what album it's in).


	MediaType

	Image

	Caption

	california_palomar_1024

	Comment

	

	Aspect Ratio

	1.333333

	Rating

	0

	Roll

	60

	DateAsTimerInterval

	139533772.000000

	ModDateAsTimerInterval

	139533772.000000

	MetaModDateAsTimerInterval

	169397100.770723

	ImagePath

	/Users/fej/Pictures/iPhoto Library/Originals/2005/Stars 1024/california_palomar_1024.jpg

	ThumbPath

	/Users/fej/Pictures/iPhoto Library/Data/2005/Stars 1024/california_palomar_1024.jpg

I have the xsl file to import this. You could also query iPhoto via AppleScript about its pictures. As you can likely see, I mess about with this stuff, as a dilettante; but I don't really use iPhoto, so I've only developed simple routines for it.

Link to comment
Share on other sites

Image Events can also do rotating

set aFile to choose file

-- or get it from a FileMaker cell



-- will rotate the image

tell application "Image Events"

	set theImage to open aFile

	rotate theImage to angle 90

	save theImage in aFile

	close aFile

end tell

So you could run these simple image operations directly from FileMaker, like a mini photo editor. Since the image is referenced, you would see the changes in the FileMaker container field. But there's a limit to what Image Events can do. If you want to do interactive editing, you need something like iPhoto.

Link to comment
Share on other sites

Try this small download for some image processing AppleScripts from Apple:

http://images.apple.com/applescript/pkg/image-templates.zip

I also ran across an article today on using AppleScript with iPhoto. First, it had a more advanced AppleScript to "find" all your iPhoto xml files, in case you have more than one (except in your Library folder; clever use of the command line "find").

set user_Folder to characters 1 thru -2 of (POSIX path of (path to home folder)) as string --This removes the terminal slash from the POSIX path.

set all_user_Libs to every paragraph of (do shell script "find " & user_Folder & " -name AlbumData.xml ! -path " & user_Folder & "/Library/*")

It also mentioned this small AppleScriptable shareware application, iPhoto Library Manager, which adds several features, mostly to do with multiple iPhoto libraries.

http://www.fatcatsoftware.com/iplm/

[P.S. I don't know about iPhoto in Leopard.]

Edited by Guest
Link to comment
Share on other sites

This topic is 6068 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.