This will all depend on how your store the image
When you import in image into a container field as a reference you can get all of that information by referencing that field in a calculation. The result of the calculation will look like this:
image: Picture.png or image: Projects/pictures/Picture.png if the image location is on the same volume as the db.
imagemac:/MAC OS X/Users/yourname/Images/Picture.png
Note if its not an image and an actual file instead the results will be:
filemac:/MAC OS X/Users/yourname/Images/Picture.png
However if you are storing the file directly into the container you will only see the file name
If you want to extract these values when referencing an image you can use the GetValue function and specify the line you want to extract and remove the prefix, so for File Name you would do the following in a calculation or Set Field script step.
Substitute ( GetValue ( ContainerField ; 2 ) ; [ ":" ; "¶" ] ; [ "/" ; "¶" ] )
; 1 )
And the the location:
Substitute ( GetValue ( ContainerField ; 3 ) ; "imagemac:" ; "" )
However if you want to get the same information when you are storing the image of file into the database then you can use a few script steps to, as you most likely currently do, insert the image into the container. but modify it slightly to first store it as a reference, use the calculations above to set a couple of text fields and the insert the image again using the filepath, but this time inserting the picture.
Something along the lines of:
Go to Field [ TABLE::container ]
Insert Picture [ Reference ]
Set Field [ TABLE::FileSize ; Substitute ( GetValue ( TABLE::container ; 1 ) ; "size:" ; "" ) ]
Set Field [ TABLE::FileName ; RightValues ( Substitute ( GetValue ( TABLE::container ; 2 ) ; "/" ; "¶" ) ; 1 ) ]
Set Field [ TABLE::FilePath ; Substitute ( GetValue ( TABLE::container ; 3 ) ; "imagemac:" ; "" ) ]
# Now you insert the file into the databsae.
Set Variable [ $FilePath; Value: GetValue ( TABLE::container ; 3 ) ]
Go to Field [ TABLE::container ]
Insert Picture [ “$FilePath” ] // maker sure to uncheck 'As reference'
Notice the calculation for the $FilePath variable does not remove the "imagemac:" prefix, this is because you need this in the path for the Insert Picture function
I hope this helps and do ask if anything is unclear.
Orlando, thanks for the reply.
I am storing the image in FileMaker, not a reference, and all I want to do is store the filename whenever anyone imports, or changes an image, so that everyone can see it.
Just to see, I created a Calculation field, result as text, with:
GetValue ( ContainerField; 1)
And that works! It returns the original filename of the image that is imported. Is there any reason not to just use this? I noticed that when you export the contents of a container field, FileMaker offers to save the file with same name as when it was imported, so that information must be accompanying the image and stored in FMP somewhere! So even though I didn't use the import as reference script steps, thanks!
"I am storing the image in FileMaker, not a reference, and all I want to do is store the filename whenever anyone imports, or changes an image, so that everyone can see it."
"Is there any reason not to just use this ?"
Yes, there is...
The file will became quicly so big that you'll re-think about this.
I'm not concerned about file size. I was only concerned with how to display the filename of an image stored in a container. Problem solved. thanks.
I have been able to get rid of the dreaded ".jpg" file extensions in the field name with a simple find/replace script. However, I am trying to do this without dialog and when the find/replace happens it still needs someone to say "yes go ahead and replace all". Is there a way to tell it to do this? I have been playing around with error messages but that isn't really what is going on. The REALLY annoying thing is that there doesn't seems to be a problem. it seems to figure it out and find/replace correctly but it makes an obnoxious sound after which when I do it with the dialog on seems to be when it is asking for permission to find/replace and you hit cancel then it pops up with "Script canceled do you want to continue"