12 Replies Latest reply on Sep 11, 2010 10:15 AM by FentonJones

    Storage of Images

    Frinholp

      Title

      Storage of Images

      Post

      Hi all

      Has anybody got an opinion on the storage of images within Filemaker and the use of 360 Works' Scriptmaster plugin?

      I require images to be associated with certain records and I am aware a container field will store an image. Is it best practice to store the image within the database or link a path to the image?

      I have been investigating the functionality provided with Scriptmaster which seems would allow me to create directories associated with a record, store images in that folder and use the Get File As Container to show an image in a container field that is external to the database. I have not yet installed the plugin so I'm not too sure if my understanding is correct???

      What types of files can be stored in a container? What will be displayed within the container field that is not a jpeg? I ask this as I would like to hold any digital correspondence such as text files, documents, pdfs or emails either by link via path name or the storage of a document itself within a field.

      Is it possible to open files with an associated application via script?

      Scriptmaster seems to offer a lot of additional functionality at no cost!

      Thanks in advance

      Lee

       

        • 1. Re: Storage of Images
          philmodjunk

          I require images to be associated with certain records and I am aware a container field will store an image. Is it best practice to store the image within the database or link a path to the image?

          There's not really a "best practice" here as it depends on the design and needs of your database. Instead, you have pros and cons and you'll have to compare them to your needs to see which works better for you.

          Images stored directly in the container field are simpler to make visible to all users. Filemaker GO users must have images stored in this manner or they won't be able to see them. The Con here is that files with lots of images stored in this manner will become much larger in size and any updates to the images require exporting the image, editing it in an image editor and then re-inserting the new image.

          Iimages stored by reference don't cause rapid file size increases and you can update an image by simply opening the image file, editing it and saving the changes. The cons here are that the images must be stored in the correct location in order for them to be opened. On a LAN with FileMaker clients this means that the directory must be stored on a shared directory that is mounted identically by all users--not always possible for mixed platform (mac and windows) networks without some careful work arounds being put in place. For web published systems, the images must be placed in a specific folder on the web server. In either case, if a file or enclosing folder is renamed or moved, all links the images will break.

           

          • 2. Re: Storage of Images
            Frinholp

            Thanks for your response Phil.

            I am developing in Filemaker Pro Advance 10

            The relocation of images, I assume, would not be an issue if I set set a field to hold the path of the containing directory. If I move the files, I change the path.

            BTW the database I am developing is intended to serve a web based gallery so there will be many. I will need to store the images locally (for backup etc) and also upload the images to a web server (php, sql).

            What is your view on the ScriptMaster Plugin? Will it be an aid to achieve my goal, or can all this be done using Filemaker's native functionality?

            Lee

            • 3. Re: Storage of Images
              philmodjunk

              I haven't used that plug in so can offer no opinion.

              The relocation of images, I assume, would not be an issue if I set set a field to hold the path of the containing directory. If I move the files, I change the path.

              The container field itself will store the path if the container is store by reference and you can get to this path to update it with a replace field contents operation. This can be trivial or very difficult depending on the number of image files involved and how they are organized on the server. (Say you have 2000 images and you move/rename a directory holding 300 of them. You'd need to find and correctly update all container fields that reference just the 300 images affected...

              • 4. Re: Storage of Images
                Frinholp

                From what I can gather Scripmaster allows me to create directories and copy files within Windows and Mac filesystems enabling me to hold images associated with individual records in seperate directories, so I should be able to keep the images quite organised. If I was to migrate the database, hopefully just updating a global field that holds the root path to image directories would be feasible. I hope I'm not being too naive here?

                I am concerned about holding the images within a container incase corruption occurs and the increasing size of backup files. Should this be a concern?

                Is it possible to open files with an associated application via script?

                I have now read that is possible to store any file type in a container even if Filemaker cannot handle that file. This can then be emailed etc. How do I go about opening this file with an associated application via use of shell / terminal? If I am able to do this, I am assuming that I would be able to do so with a referenced file. I could be jumping the gun though.

                Thanks again

                Lee

                 

                 

                 

                • 5. Re: Storage of Images
                  philmodjunk

                  From what I can gather Scripmaster allows me to create directories and copy files within Windows and Mac filesystems enabling me to hold images associated with individual records in seperate directories, so I should be able to keep the images quite organised. If I was to migrate the database, hopefully just updating a global field that holds the root path to image directories would be feasible. I hope I'm not being too naive here?

                  A bit, Filemaker cannot create new directories. You can with a system script like Applescript and there are file manipulation plug ins that can. And just updating a global field won't fix the file references unless you add calculation fields that return a type container that use the global field in combination with the filename to compute the reference path.

                  To open such a store by reference image can be as simple as using Export Field Contents either from the Edit menu or in a script if the filetype is associated with the correct application on the client's computer system--with filemaker clients. You don't have this option in web publishing.

                  • 6. Re: Storage of Images
                    Frinholp

                    Always a great help Phil

                    hopefully just updating a global field

                    Probably the wrong choice of word. I wouldn't expect anything to be that simple in this development lark lol. I expected to have to use a calculation to create the full reference path in respect of the base folder which would be stored globally. It is good news to hear that it is possible.

                    I am aware FM will not natively allow me to create directories on a filesystem. However, the plugin aforementioned claims that it is capable. I think it uses JAVA to accomplish this.

                    http://www.360works.com/scriptmaster/#description

                    Thanks for the advise on opening associated applications. So it's a case of making sure the client computer's OS has its file associations setup correctly. Even better news.

                    Thanks again 

                     

                    • 7. Re: Storage of Images
                      Frinholp

                      Testing both methods of storing a reference to or storing the actual  image inside a container field, I ahve encountered the following:

                       If I right click on an empty field, I am able to insert an image in the container and the image is displayed in the container field.

                      I would like to drag 'n' drop files into the container field. If I drag the same image that I inserted using the method aforementioned, I am diplayed a generic image that seems to indicate the file type, but also displays the image name.

                      However, if I drag a document such as an Excel document into the container I get what seems like a preview to the file with no filename displayed.

                      How do I get the image to show?

                      If I use the right-click method of inserting files, I get the option to store by reference. Is there a way to store by reference by drag 'n' dropping a file into the container?

                      Activate Contents Packager Shell Object

                      This opens up the file in what seems to be the OS's associated application.

                      What does this mean exactly, and what is the process on press?

                      Thanks in advance

                      Lee

                      • 8. Re: Storage of Images
                        philmodjunk

                        When you drag and drop you are doing the equivalent of an Insert Object command from the insert menu. This won't produce the same results as an Insert Picture action which is specifically designed to work with graphic images while Insert Object is more generic.

                        • 9. Re: Storage of Images
                          Frinholp

                          Do you know of a method of determining an object's file type so that I can capture it and use an If statement to use 'Insert Picture' script function if the file is an image?

                          Cheers again 

                          • 10. Re: Storage of Images
                            Frinholp

                            That is assuming that there is a way of capturing the refernce path when using drag 'n' drop. :-) sorry!

                            • 11. Re: Storage of Images
                              philmodjunk

                              Not with drag and drop, as far as I know...

                              • 12. Re: Storage of Images
                                FentonJones

                                There is a plug-in which can do cross-platform drag 'n drop, Troi File. It allows you to define "drop zones", either the container field itself, or other. It can capture the image path and let you run your own script to Insert. But it is nowhere near free. It can also do a great deal of file/folder maniplulation (and it is fast). 

                                There is also the SuperContainer plug-in, by 360Works (makers of ScriptMaster, also Java-based). It is sort of like the packaged version of everything you'd want to do with ScriptMaster and images. I've not used it myself, but many people use it.

                                In some ways it comes down to whether you want to, and know how to, roll your own. You can get more flexibility that way, at the cost of more work. SuperContainer runs mostly on the server machine; its cost is usually lower than single-station priced plug-ins.