4 Replies Latest reply on Oct 23, 2012 12:22 PM by philmodjunk

    Open image in container field, stored externally

    MichaelLawrence

      Title

      Open image in container field, stored externally

      Post


           I've got a FMPro 12 Advanced database where I pull my images from a security camera, and they are stored exterally.

           I want my users to able to open the file from inside the database. I know that I can use the Export Field Contents function to move them where I want on their hard drive, but it's too complicated for them.  I'm not sure if there is a way to make it a simple double-click or button for my users. The 'Insert from URL' function is the way they're pulled into the database so there's no hope of simply clicking 'store as reference' as suggested in other threads.

           Does anyone know of a way to accomplish this? I know that Filemaker Go apparently has this option but I've not been able to find one for FMPro 12.

        • 1. Re: Open image in container field, stored externally
          schamblee

               Here is a sample app that uses the web viewer to show images.   The first record uses a image located on the internet.  The second record uses a local path on my computer.   You can test with a local path on your computer. 

               If the web viewer works for you then you will only have to store the path to the image and you can create a timestamp when you create the record.  I have read all your post.  Is your camara software created the date with the forward slashes?  If you are trying to append the  datestamp to the filename from within filemaker you can use substitute command to change the slashes to underscores in the date.

               Example : Set Variable[$filename;value:"file:"& filename & substitute(theDate;"/";"_")&".jpg"]

          https://www.sugarsync.com/pf/D9559058_790_855775827

                

          • 2. Re: Open image in container field, stored externally
            philmodjunk

                 Export field contents can also be used in a script attached to a button so that your users only click the button and the image opens for them. The main limitation to look out for is that if they need to edit the open image and save the changes back to your external storage location, you'll need to add yet another button that "saves" the changes by re-inserting the file from the exported location back ito the container field.

            • 3. Re: Open image in container field, stored externally
              MichaelLawrence

                   Phil, I tried what you gave me earlier to export field contents:

                   Set Variable [$Path ; Get ( TemporaryPath ) & "fileName.jpg" //specify the extension that's right for your file] it is a .jpg
                   Export Field Contents [ Container Field ; $Path]

                   and my code looked like this:

                   Set Variable [$OpenImage ; Get ( TemporaryPath ) & "fileName.jpg"]
                   Export Field Contents [ Invoices::Photo; $OpenImage]

                   Am I missing something?

              • 4. Re: Open image in container field, stored externally
                philmodjunk

                     Be sure to click the check box option for automatically opening the file when it is exported. This is found in the Specify Output File dialog box.

                     You may not want to always name your file "filename.jpg"--particularly if users might need to edit the open file and save it back to the external location as the opened file will have "filename.jpg" as its filename and you can't have two files with the same name in the same directory specified for your external storage. If that's a possible issue, you may want to refer to text in a field that contains the flie name instead of using "filename.jpg".