6 Replies Latest reply on Jan 16, 2010 1:15 PM by davidanders

    Referenced image problems over network with PC and MAC

    skowens

      Title

      Referenced image problems over network with PC and MAC

      Post

      I use FMP 10 on both a Mac running OSX and a PC running Vista and I'm essentially a novice when it comes to calculations, scripts, etc.  

       

      I have several databases that have container fields for images.  In the past, as I've created records, I've just used "Insert Picture" to insert a reference to the image for each record.  Copies of the images are stored locally on both the Mac and the PC (though I would like to eventually get this to work without that redundancy).

       

      In the past, when I was running an earlier version of FMP, I was able to host the database on the Mac and access the database from the PC remotely over our wireless network.  For whatever reason, the images always showed up just fine and there were no issues with file paths, despite the fact that I never set up any sort of calculation to tailor the filepaths to whichever machine was accessing the database.  Recently, after some corruption issues which have been resolved (as best I can tell), and upgrading to FMP 10, the images aren't showing up properly on the PC when it remotely accesses the databases on the Mac.

       

      So, in an effort to correct this, I've been trying to redo the container fields as calculations to automatically reference the proper images, regardless of which machine is accessing the database.  The calculation that I'm currently using is:

       

      If (Abs (Get (SystemPlatform)) = 1;

      "imagemac:/Macintosh HD/users/kenklosterman/documents/collection apparatus/" & Number & ".jpg" ;

      "imagewin:/C:/Users/langsem/Documents/Collection Apparatus/" & Number & ".jpg")

       

      Here "Number" is the field that contains the unique record number, which corresponds to the name of the image files.  Copies of the images are stored on both machines (but if I could get it down to one machine, that would be preferable).

       

      The problem is that when I test this on a very basic test database that I've set up, when a record is created by either machine, it automatically and correctly references and displays the proper image file.  When I view that same record on the other machine, however, the file path appears to be stuck on the path for the other machine.  i.e. if a record is created on the Mac, it always points to the Mac path even if I view it on the PC, and vice versa.

       

      I've read through a thread on pretty much this same topic, located here, which offered a similar calculation to the one I'm using, but I don't see what that calculation has that would make such a difference (again, I'm a novice at calculations and scripts).  From what I can tell, the database isn't recalculating the contents of the field every time each record is viewed.  So, any thoughts on what I'm doing wrong?  Will I also be able to automatically redo all the old images by running a script or a Replace Field Contents calculation?  Any advice will be very much appreciated...

        • 1. Re: Referenced image problems over network with PC and MAC
          mrvodka
             Well when you store an image as a reference in a container field, it stores the path to the location. Therefore, if you are on a PC it will have a different path inserted than a mac. If you try to access it from the mac it doesnt understand the location. If you store the images in one shared location, then you can mount that location for your mac and use as network shared path for your PC. Then a new calculation with container result could display it as the post where Fenton wrote showed.
          • 2. Re: Referenced image problems over network with PC and MAC
            FentonJones
              

            Does the calculation have its Storage set to (•) Do not store? Many Get() functions require that they be unstored, in order to re-evualate each time they are used.

             

            There would be a problem if the 1st part of the path changes later, say to the server or its folder path. But you could just modify the calculation to use the new  path; i.e., set the 1st changeable part of the path via the calculation itself, rather than relying entirely on the inserted path. You can also do a Replace on the container paths themselves (at least that's what I've read; never had to do it myself, because I just calculate it).

            • 3. Re: Referenced image problems over network with PC and MAC
              skowens
                

              I read about that storage option on the other post I referenced, but I must be missing something because I don't see it on the calculation window or on the field options menu.  Where is that option located?

               

              I also don't quite understand how setting files up on a network drive mounted on the Mac would work since it would still result in a different file path for the two machines.  Can you guys give me a little more (on a beginner's level)?

              • 4. Re: Referenced image problems over network with PC and MAC
                skowens
                   Come on.  Anyone?  I feel like I'm close to getting this stuff to work, but I could really use a hand.  Novice here.
                • 5. Re: Referenced image problems over network with PC and MAC
                  davidanders
                    

                  The Mac is hosting the database

                  The Mac is creating records and storing images that are referenced in the same container field.

                  These images added by the Mac are stored in a (not in Filemaker folder) folder. 

                  The PC is remotely accessing the database hosted on the Mac.

                  The PC Is creating records and storing images that are referenced in the same container field.

                  These images added by the PC are stored in a folder on the PC

                   

                  Paths to referenced images can be relative or absolute

                  NOTE: the database file is in C:/Documents and Settings/username/My Documents/DatabaseFile/

                  This is the relative path  [file could be image instead] [agnostic win or mac]

                  file:../FileMaker Docs/FMPA New Features.pdf

                  The starting point is the filemaker database

                  The two dots mean go up one folder

                  Slash Go to this folder "Filemaker Docs"

                  Slash This is the file  "FMPA New Features.pdf"

                   

                  This is the absolute path for windows  [file could be image instead]

                  filewin:/C:/Documents and Settings/username/My Documents/FileMaker Docs/FMPA New Features.pdf

                  The starting point is Drive C:

                  Slash Go to this folder "Documents and Settings"

                  Slash Go to this folder "username"

                  Slash Go to this folder "My Documents"

                  Slash Go to this folder "FileMaker Docs"

                  Slash This is the file  "FMPA New Features.pdf"

                   

                  To construct a container field with a calculation we need these fields

                  Field "ContainerWin"  contains [filewin:/]

                  Field "Drive" contains [C:/]

                  Field "Folder1" contains [Documents and Settings/]

                  Field "Folder2" contains [username/]

                  Field "Folder3" contains [My Documents/]

                  Field "Folder4" contains [FileMaker Docs/]

                  Field "Folder5" contains [] 

                  Field "FileName" contains [FMPA New Features]

                  Field "FileExt" contains [.pdf]

                   

                  ContainerWinCalc (the calculation for Windows Computer that has the database open)

                  ContainerWin & Drive & Folder1 & Folder2 & Folder3 & Folder4 & Folder5 & FileName & FileExt

                   

                   

                  ContainerCalc (cakculated field with container as the result)

                  If computer is windows use ContainerWinCalc, if not use ContainerMacCalc 

                   

                   

                   

                  FMP HELP > Records script steps > Import Records

                  http://www.filemaker.com/help/html/scripts_ref1.36.68.html 

                   

                   

                  Plugins that MIGHT work for you

                  MediaManager
                  http://www.filemaker.com/company/newsroom/releases/1303124.html
                  SuperContainer
                  http://www.filemaker.com/company/newsroom/releases/1303203.html
                  TroiFile
                  http://www.filemaker.com/company/newsroom/releases/1303201.html

                   

                  .



                  • 6. Re: Referenced image problems over network with PC and MAC
                    davidanders
                      

                    I would store the images in a folder called "Images" next to the database file.

                     

                    The Relative Paths would be

                    file:/Images/filename.ext

                    filewin:/Images/filename.ext

                    filemac:/Images/filename.ext

                     

                    image:/Images/filename.ext

                    imagewin:/Images/filename.ext

                    imagemac:/Images/filename.ext