Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

  • Newbies
Posted

In Form View, I understand that you can have a text label show the contents of a field like so: <>

I'm looking to have a similar text label that shows the dimensions of whatever graphic/image has been pasted into a container field named, let's say, "image."

Is there a function that returns a string containing this information? Ideally, I'd like the text field to display something like "320 x 240," but being able to see anything at all would be helpful.

Is this even possible?

Posted

GetAsText ( container field ), result text, will return info. If you've used Insert [ [x] Reference only, then it will have 3 lines. The 1st line will have the dimensions:

size:439,476

However, if you did not check [x] Reference only, the only info returned will be the file name. In that case you would have to Export Field Contents, to create as a file again.

  • Newbies
Posted

Thanks so much for the reply!

All of the graphics in the container field have been pasted in from the clipboard, so there wouldn't even be a filename.

I'm guessing this function works only if you use "Insert" --> "Picture..." is that right?

Posted

I'm guessing this function works only if you use "Insert" --> "Picture..." is that right?

That would be a good guess.

Lee

Posted (edited)

Yes, Copy/Paste is generally not a good idea; use Insert. You do not get a name when you copy/paste, and the data size increases.

When I Copy/paste what was an 82K JPEG picture file into FileMaker, the size becomes 183K. [ Use Length ( container field ) to see this.]

If I Export Field Contents, it becomes a 115K file. But it DOES have the same dimensions (640x480 in this case). So, even if you copy/pasted the picture in, you could Export Field Contents, to a known location, and read the dimensions.

But we have no way of know what you want the final image to be, an embedded picture or just a reference to an image file. There are pros and cons (several). It depends on what environment it is going to be viewed, whether you have a "file server," or whether you just want to embed some little pictures.

In the case of "embed some little pictures",* if you still want the size, the best way is likely to use AppleScript to get this info from the file directly.

There's a couple ways to do that, either the background graphics app "Image Events", or its command line counterpart "sips." This AppleScript will return the Height and Width of the chosen file:

set x to quoted form of POSIX path of (choose file)

set H to last word of (do shell script "sips -g pixelHeight " & x)

set W to last word of (do shell script "sips -g pixelWidth " & x)

-- kind of inefficient, calling it twice, but easy to read

Rather than setting x to a chosen file, you'd set it to a Unix syntax path from FileMaker; which would then need to be quoted.

H & W could then be set into FileMaker fields, within the AppleScript. Let me know if you want to do this, and I'll tell you more specifics.

* If you do not want embedded pictures, then you'd re-Insert the file as a Reference, which would also bring in the dimensions (see my earlier post).

Edited by Guest
  • Newbies
Posted

Thanks so much for the information!

It's eye-opening to learn that pasting clipboarded graphics will actually take up more space; I've encountered the same thing in Windows with Microsoft Word.

Sounds like the lesson to be learned is to always insert graphics from the menu and not the clipboard!

Posted

TBHis thread is reminding me of a question I've been meaning to ask -- Let's say I have a container image for pictures. Is there a way to do a Find that will return records whose container field is *empty*?

I'm thinking not directly -- but I could make a separate calc field: Use Length ( container field ) and then just search for records where this field = 0 and those would work?

I'm thinking this is probably a fairly commonneed - is there a standard approach?

Thanks.

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