11 Replies Latest reply on Nov 23, 2012 12:22 PM by BobSeng

    Image referenced by other field



      Image referenced by other field


           I don't want to embed images in the database, I want to point to the appropriate image to display in my layout.  Each record has an inventory number which is also the image's filename on my computer.


           In my field (Inventory Number) is "1234" which is the unique inventory number of this particular item

           The appropriate picture resides at C:\Users\Bob\Documents\Databases\Inventory Pictures\1234.jpg


           How do I do that?

        • 1. Re: Image referenced by other field

               Sample app that use a web viewer to display images.  You can use internet path and or local path.


          • 2. Re: Image referenced by other field

                 You can also use Insert picture with the "store a reference" option specified to insert the picture from that location. This inserts the filepath to that file rather than embedding it.

                 But other users of your database will not be able to see the image at that location unless they also can use the same exact file path to access the image file directly.

                 If you have FileMaker 12 and are hosting your database over a network, you way want to explore the external storage options that were added with filemaker 12.

            • 3. Re: Image referenced by other field

                   Thank you S Chamblee, I see that you were able to do the kind of thing that I'm trying to do, but I'm afraid you're a bit beyond me at this point.  I don't the programming language or syntax and so I don't know how to incorporate it in my layout.  I'm playing with the trial version of FM and thinking of switching my database manager to Filemaker from Access since I'm changing computer platforms.  Access seemingly makes this referencing much easier to accomplish.


                   Thank you PhilModJunk, excuse my ignorance (new to Filemaker) but I think the filename needs to be "calculated" on the fly (as I move from record to record) from a string that includes the fixed path and also the contents of the "inventory number" field (which is the filename) in each record...plus the ".jpg" extension.  I don't see a way to construct that calculation and give it to the container field so it knows where to go to find the pic.  What am I not understanding?

              • 4. Re: Image referenced by other field

                     The filename does not need to be calculated on the fly as this info is stored in the container field as part of the inserted file path.

                     Try using Insert Picture from the insert menu to insert an image file into a container field. Be sure to click the "Store a Reference" option when you do so.

                • 5. Re: Image referenced by other field

                       Something I haven't mentioned, and should have.  I've converted an old Access database with thousands of records.  I don't want to go through and individually insert each photo for each record to migrate the data with pictures to FM.  All the records do have the inventory numbers (same as file names) and I was hoping to be able to construct a calculation (or instructions) so that just by viewing each record it would have the information to find each picture.


                       Perhaps I need a script to go through the records and automatically insert each photo to establish the linkage...

                  • 6. Re: Image referenced by other field

                         You should not need to do so. But I do suggest that you follow my suggestion as a way to get familiar with how container fields work as what I have described is a very simple way to insert image files into your database.

                         A script that goes through and inserts each image is certainly doable, but you don't actually have to do this if you have a text field that stores an accurate filepath to each image.

                         You can update the file path inside the container field with a Replace Field Contents operation just as though the container field is a text field. The trick is to use the "calculation" option and to set up a calculation that takes the file path in the text field and uses it to produce a file path with a format that is valid for your container field in order to place it in the container field.

                         A typical text entry in a container field that stores a reference to an image file inserted via the Insert Picture option will have this format:

                         image:95358 W modesto.bmp
                         imagewin:/C:/Documents and Settings/Phil/My Documents/My Pictures/Zip maps/95358 W modesto.bmp

                         First line is the pixel dimensions of the file. If I remember correclty, you do not need that line for the container field to function correctly. Second line is the "relative path" reference that contains "image:" and just the file name. Note: if you place a file of this name inside the same directory as your database file, this reference will find and access that file instead of the file whose path is stored in the third line. The third line stores the fully qualified file path to the image file starting with a case sensitvie "imagewin:" or "imagemac:" depending on the operating system on which FileMaker was installed at the time the file was inserted.

                    • 7. Re: Image referenced by other field

                           Thanks for your EXTREME patience!  What you're describing makes perfect sense and I tried everything I could think of to find where that file path data was stored before even coming to the forum.  I'm probably an idiot and overlooking something very obvious...but how do I access the container field's file path??  BTW, I'm using FMPro12 in case that makes a difference.

                      • 8. Re: Image referenced by other field

                             FMPro`12 offers a potentially very useful set of new container field options. They also complicate the process but don't affect anything I've posted in this thread to date. If you plant to host the database over the network so that multiple users can access your database and see the inserted images, I strongly recommend that you research Filemaker Help about the "external storage" option that is available with FileMaker 12. This allows you to insert files as though you had embedded them, but FileMaker copies them to a directory on the server so that all clients can access them.

                             If you want to see the text data--including the file path for a given container field, you can add a calculation field (yeah I know, in access you don't have calculation fields so this approach--which is common in FileMaker will seem odd to you at times), select "text" as the return type and then select your container field as the sole term in your calculation expression. Place this new field next to the container field and you can then insert image files into the container field and see the text appear in the container field. If you have FileMaker Advanced--something that I highly recommend that you acquire, you can also set up a "watch" expression similar to what you can do in access that uses getAsText (YourTable::containerField) to display the current text data in a container field.

                             To modify the text data in a container field, you can use set Field, or Replace Field Contents just as though this is a simple data file.

                             Using the above example, if "/C:/Documents and Settings/Phil/My Documents/My Pictures/Zip maps/95358 W modesto.bmp" is stored in a text field named: MyTable::FilePath, I can use this script step:

                             Set Field [Mytable::containerField ; "imagewin:" & MyTable::filePath ]

                             To insert a reference to the file into the container field. I don't have time to test that, but I think you can get away with that simple of an approach, I don't think that you have to recreate the first two lines of text (Each ends in a return), in order for the image to appear in the container field.

                        • 9. Re: Image referenced by other field

                               I've been away rethinking this, and two things have made me change my mind about embedding.  In Access, when I embedded pictures they were automatically converted to bitmap and even a 40kb jpg file turned into a 1mb file which made the database HUGE.  I understand that's not the case in FM.  I'm told jpg files are stored in FM in essentially the same size and format as the original jpg files, so that's no longer an obstacle to embedding.  Another important factor is that I want to be able to put a copy of the database on an iPad when we travel, and I'm told that the internal filekeeping is a completely different structure so referenced pictures won't work (without difficulty?) on both my desktop and iPad.  SO, it now looks like what I want to do is to embed the images...to somehow automate the insertion of 10,000 pictures into 10,000 records.  Would that be as easy as writing a one-time script to insert the images in the FM database?  Is that something you would be interested in doing for me (or helping me with)?  It doesn't seem like a big deal, but I haven't been able to figure out the commands or functions or syntax to successfully accomplish it.  I don't even know if that's something that can be done in Pro or if you need Pro Advanced.  Is there an better way for us to communicate away from the forum to possibly pursue this? 

                          • 10. Re: Image referenced by other field

                                 Take a look at the Import Records | Folder option. It allows you to import image files into a table with a container field all in one "batch" operation.

                            • 11. Re: Image referenced by other field

                                   OMG...THAT DID IT!  I'm forever in your debt....THANK YOU!

                                   signed..."the rookie"