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.

Need easy way to recognize PNG in container

Featured Replies

I have an instance where a container field is occupied by an image of unknown type.  It might have been inserted or pasted in ... or imported.

It will be accepted for further processing only if it's a PNG.

How can I easily determine that?  When I look at the actual header bytes of the file (after exporting it), "PNG" is clearly visible.  Yet I wasn't able to get those first 4 bytes with a Left ( text ; 4 ) directly from the container.  Is there a way to do that?

Thanks in advance for any help.

565f5a36ced8b_PNGHeaderBytes.PNG.028bf42

 

Edited by K1200

  • Author

Thanks for the response ... but I had looked for some definitive image attribute and couldn't spot one.  Did I miss it?

filename seems to only apply to inserted files and not to pasted images.  But I'll try some additional searches.

What do you get when you put this in Data Viewer?

RightWords ( GetContainerAttribute ( yourTable::yourContainer ; "filename" ) ; 1 )

 

Note - don't use Get ( FileName ) ... type the literal text just as it shows "filename" ...

It works when I drag an image into the container and also works when I use Insert.

Edited by LaRetta

On Thu Dec 3 03:57:43, K1200 said:

filename seems to only apply to inserted files and not to pasted images.

IIRC, a pasted image would never be PNG. But this might be outdated.

I can copy a png and paste into container and it works in same wayl, at least on El Capitan.  I also imported and got same results.  :-)

It works in Yosemite too

I need to correct myself.  I forgot about the word separator behavior in FM where 'alpha-dot-alpha' is counted as one word.  There are many ways to get the extension from the file name ... here is one:

Let ( 
name = GetContainerAttribute ( yourTable::yourContainer ; "filename" ) 
;
RightValues ( Substitute ( name ; "." ; ¶ ) ; 1 )
)

or to eliminate the trailing return:

Let ( 
name = Substitute ( GetContainerAttribute ( yourTable::yourContainer ; "filename" ) ; "." ; ¶ )
;
GetValue ( name ; ValueCount ( name ) )
)

 

Edited by LaRetta

  • Author

 

@LaRetta:  Thanks.  That does work.

But in Windows on my PC, I've found that a simple GetAsText also returns the file's name, just like GetcontainerAttribute.  I haven't tested all file types, but it seems to work for PNGs.

Thanks for the other responses, also.

 

 

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.