Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Some quick help for a novice regarding picture fields... (link to iphoto)


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

Recommended Posts

  • Newbies
Posted

I've got a simple database with 6 meta-data fields and one photo field that is referencing photos on the hard drive via the import feature.

I would love to be able to do two things.

#1, auto-size the photo box based on the orientation of the picture (ie, if I have a 640x480 picture box and a given record contains a portrait oriented photo rather than a landscape one, it should size the box accordingly and move it flush left so that there isn't blank space on both sides.

#2, (and maybe this isn't the best way to do this so I'm open to suggestions), Can I add a link to the photo so that it will open the photo in iphoto? Essentially the reason for this is to zoom in on it and examine it closely.

I apologize in advance if these are answers easily found through a search, I searched for a bit but couldn't find them and I'm in a bit of a rush. Thanks very much.

  • Newbies
Posted

A quick way to accomplish #2 is to make your image thumbnail a button linked to a one-step "open" script: use Export Field Contents to export the image to the local temp folder, and select the "automatically open file" option under "specify output file."

No clue on #1.

Posted

1. You cannot have the field resize automatically - but you can set it to align the image to the left/top (in Format > Graphic…).

2. Double-click the container field to open the referenced image in its default application. You can also create a button to do the same. On a Mac, you can also run an Applescript to open the image in a specific app.

  • Newbies
Posted

1. You cannot have the field resize automatically - but you can set it to align the image to the left/top (in Format > Graphic…).

I think I got this for the most part, but for some reason there's a dotted line running horizontally across the page about 756px from the top, and if my photo box extends below that, it gets cut off and put into a new record. I can't seem to delete, move, or identify this dotted line.

2. Double-click the container field to open the referenced image in its default application. You can also create a button to do the same. On a Mac, you can also run an Applescript to open the image in a specific app.

I'm on a mac, do I need to use applescript? I would love it if double-clicking the container field opened the referenced image in it's default location, that's what I'm trying to accomplish but it doesn't do that.

Posted

That line is a page boundary. It should have no effect on what happens in Browse mode. If you're in Layout or Preview mode, then double-clicking the field won't do anything.

You don't HAVE to use Applescript - unless you want to open the image in other than the default app.

  • Newbies
Posted

That line is a page boundary. It should have no effect on what happens in Browse mode. If you're in Layout or Preview mode, then double-clicking the field won't do anything.

Whoops, thanks, figured that out.

You don't HAVE to use Applescript - unless you want to open the image in other than the default app.

So in layout mode, I select the picture box, then from the "format" menu on the top, I select "button setup"... By default it is set to "do nothing".. I can't find the appropriate command to simply open the file... I know that if I select "Export field contents" it will give me a dialogue box that allows me to choose where to export it, and a checkbox to open after saving... that check box is really what I'm after without having to make a duplicate copy of the file. But I don't see a command that says "Open field contents"

Posted

[color:blue]Go to Field [select/perform ; YourContainerField] will do this. You'd better put this in a script, and follow it with [color:blue]Go to Field[] (nothing selected) or [color:blue]Commit Records[], to get the cursor out of the field.

  • Newbies
Posted

[color:blue]Go to Field [select/perform ; YourContainerField] will do this. You'd better put this in a script, and follow it with [color:blue]Go to Field[] (nothing selected) or [color:blue]Commit Records[], to get the cursor out of the field.

This doesn't appear to do anything but highlight the photo.

Also, please note that these are imported in batch as photos (reference only), not as files.

  • Newbies
Posted

I got it.

Changed the button properties of the photo to "Run Applescript" and inserted the following:

tell application "FileMaker Pro"

set filePath to cell "Picture" of current record

set filePath to filePath as string

end tell

tell application "Preview"

activate

open file filePath

end tell

Posted (edited)

Yes, that'll work. You don't really need the "as string" conversion, as the cell returns a valid "file" reference.* The following will open the picture in whatever your default graphic app is. As comment said, you can put whatever app you want instead, iPhoto for example.

tell application "FileMaker Pro"

set filepath to cell "Picture" of current record

end tell

tell application "Finder"

activate

open filepath

end tell

*Actually I should say it returns what would be a valid "file reference" if the file is there. It has no idea at that point whether it is or not; and a file reference does not care. An "alias" reference would.

Edited by Guest
file vs. alias
Posted

please note that these are imported in batch as photos (reference only), not as files.

Ah. I am sorry I mislead you a bit - double-clicking the container directly won't work in this situation (there are so many container nuances, I sometimes forget which one does what).

It could still be done by "double-clicking" a calculation field, but there's a simpler way: use the Open URL[] script step. Since every method of getting an image/file results in a slightly different textual path stored in the container field, I have come up with the following method to get a suitable URL:


Open URL [ No dialog ; 

Let ( 

path = GetValue ( Table::Container ; ValueCount ( Table::Container ) ) 

;

Replace ( path ; 1 ; Length ( LeftWords ( path ; 1 ) ) + 1 ; "file:/" ) 

) ]

I believe this should work cross-platform for any REFERENCED contents (images, PDFs, movies and files), whether they were inserted or imported.

This topic is 5832 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.