Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Display Container field's image dimensions?

Featured Replies

  • Newbies

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?

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.

  • Author
  • Newbies

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?

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

That would be a good guess.

Lee

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

  • Author
  • Newbies

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!

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.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.