2 Replies Latest reply on Apr 26, 2010 9:37 PM by thachlam

    Script to insert photos

    thachlam

      Title

      Script to insert photos

      Post

      Hi,

       

      I am totally new to Filemaker and I have to import 10000 records of data and photos to a database. It would take weeks to insert photos into each record. Would someone help me with a script to display photos in container fields with imported links (in different field). Many thanks for help.

        • 1. Re: Script to insert photos
          FentonJones

          There is an Import Records -> Folder menu command (or script step) which can Import an entire folder (and optionally subfolders) of image files at once. You will get the Image (container field), File Name, File Path (URL syntax), and optionally create and import a 128 pixel thumbnail (container field).

           

          If you check the [x] Import only a reference to each picture file, then the image's container field will include the file path (FileMaker syntax). I say "include," because it has 3 lines (if a local disk), with dimensions of the image, a "relative path" (not very useful), and the "absolute" path (last line). This data can be extracted from the image in the container, using GetAsText (container field).

           

          So that's one way. Another entirely different method would be to just Import only the file paths, then create a calculation which coerces them to FileMaker syntax, with a result of Container. In other words, if you can create a calculation which produces the FileMaker syntax path of the image file, it can display the image.

           

          Or you can import an OS syntax path (which is different on Mac or Windows, but only slightly), and use that for the calculation, coercing it to FileMaker syntax. (Different syntax file paths can coerced to another, using Text functions.)

           

          Which method you use depends on several factors. Many of which have more to do with the way you organize the image folders, how you use the image files, and whether this is a hosted/networked FileMaker file (and if so, which OS, or both), or just a local file. There is no "perfect method for every situation" (or it would be the only one). If you described your situation and work flow in more detail we'd be able to better help you decide. Sometimes even then there's more than one method which would work. It is even possible to combine the "plain container" and "calculated container" methods.

           

          There are also plug-ins, such as SuperContainer, which handle quite a bit of the work in a hosted/networked situation, but have their own restrictions/limitations.

          • 2. Re: Script to insert photos
            thachlam

            Thanks so much for the information and here are the details of the database that I am building with Filemaker Pro Advanced 11 on WinXP SP3:

             

            - Each job record will have a photos section that has 2 container fields to display the imported photos (not thumbnails). These photos may not be from the same folder (taken from 2 different cameras).

            - Each photo will have 3 extra fields to display  -1. Camera Number, -2. Photo's ID, -3. Path to Photo. These information will be exported into Excel monthly for reporting purposes.

            - All photos will be stored in one or more disk images and only references get imported to Filemaker.

            - Photos will be imported via 2 ways: Manually clicking the container fields or importing references from Excel spreadsheet.

            - An example of photo link: APR2010/Camera10/15-04-2010/IMG_2011.jpg

             

            Writing a script to display the imported photos and their details into separated fields is a big task for a novice like me, therefore, your help and tips are highly appreciated.