5 Replies Latest reply on Jun 11, 2010 8:44 PM by FentonJones

    Help please! Adding an import photo button to a database

    Fuzzy

      Title

      Help please! Adding an import photo button to a database

      Post

      Hi, I am a newbie at File maker and am having trouble creating a button on my database that will browse the photo's on my computer and allow me to import a picture for each record. I am using FM10 on a mac. Can anyone give me some pointers?

       

      Cheers

        • 1. Re: Help please! Adding an import photo button to a database
          Mystick

          take a look at Troi File plug-in.

           

          it helps with interracting with physical files.

           

          With it you could retrieve a list of physical files on your computer and then loop through it to upload the images inside records.

          • 2. Re: Help please! Adding an import photo button to a database
            FentonJones

            You don't need Troi File (which is great) on a Mac to deal with external files, unless you want a cross-platform script. Macs have AppleScript, which can also run Unix command line, which can search using either plain Unix find or mdfind (metadata find, which is what Spotlight uses). It's a little geeky, but fast. AppleScript can be run (very well) from FileMaker, using the Perform AppleScript step (in this case the "native" option).

             

            The following AppleScript will find all the files in your Documents folder, to a depth of 10 subfolders, which have either ".jpg" or ".tif" as the file extension. You can add more. [Read later post; the mdfind command is easier to use and less problematic.]

             

            do shell script "find ~/Documents -type f -maxdepth 10 -iname '*.jpg' -or -iname '*.tif'"

             

            The result is a return separated list, which you can set into a FileMaker field, then go thru, add on what you need for a FileMaker syntax path, and Insert into a container field. Or just show the file via a calculation path.

             

            For example:

            /Users/fej/Documents/Landscape II/Plants/agave_attenuata_opt.jpg

            would be:

            filemac:/Macintosh HD/Users/fej/Documents/Landscape II/Plants/agave_attenuata_opt.jpg

             

            I don't have time to say more right now, but post again if you'd like more instructions.

            • 3. Re: Help please! Adding an import photo button to a database
              philmodjunk

              I haven't used it, but the free Moo Plugin has a list folder contents function. It's windows only but it might provide the complementary half to Fenton's Mac Only approach.

              • 4. Re: Help please! Adding an import photo button to a database
                ryan

                Fuzzy:

                to clarify, are you trying to:

                1.  Create a button on your layout to import a picture for a particular record?

                2.  Create a button that would import an x amount of images into their respective records in a found set?

                 

                 

                Also, do your records have a field which matches or corresponds to the correct name of the image file?

                for example, FieldA="Cat" and the matching image for that record is "Cat.jpg"?

                 

                 

                 

                Mystick, Fenton, and Phil are the Pros, but i just was curious if you were asking for something a little "simpler" and more native to FMP.

                 

                All the best.

                • 5. Re: Help please! Adding an import photo button to a database
                  FentonJones

                  This is probably a better way to find image files. It uses the find metadata command, mdfind, and the newer way to find images. This will find all the image files in your Home Pictures folder, no matter what extension (if any).

                   

                  do shell script "mdfind -onlyin ~/Pictures/ kMDItemContentTypeTree =\"public.image\""

                   

                  The find command I posted earlier has a few drawbacks. It finds some oddball .Thumbnail files. It did not find files with different, or no extensions. It also returned "//" after the Pictures folder. All of which could be dealt with, but with much more hassle. Both were very fast.

                   

                  [P.S. There are escaped double-quotes within the command, escaped with \", just like in FileMaker. There were single quotes also, but they were not needed in this case, so I removed them; simpler.]