4 Replies Latest reply on Feb 4, 2010 4:52 AM by 3WaveGuy

    Displaying an image from a file reference



      Displaying an image from a file reference


      Newbe question:

      On Click of 'image_addr' field, I would like to display an image (address of which is in 'pictures' table field called 'image_addr' e.g. c:\images\abc.jpg).

      I want to display it in a container field called 'imagecontainer' on a layout 'mainfile layout'.

      Also is there a reference where I can read more on this?



        • 1. Re: Displaying an image from a file reference

          Do you know how to store an image in a container field by reference? I think that's what you are requesting here.


          Define a field of type container and put it on a layout.

          Click in the field and choose insert | Picture.

          Select the file from the dialog that pops up.


          Now you'll see the picture from the file you selected in the container field.


          If that's not it, let me know in your reply.

          • 2. Re: Displaying an image from a file reference

            Yes, I have stored an image from a field in a container field (the sample code was in the contacts database sample (Add an Image script)), and it works well (just the import image button).

            I pick a field from the dialog box, click ok and it displays immediately.




            I want a script to display any image that I click (its address field e.g. c:\images\abc.jpg) into that container.


            I have a table that describes an image, names it, and tells where it lives on the c: drive.

            I want my script to display (on click of address field) the file referred to in the address field in the container field.

            Do you understand?

            The address field is the reference to the file. The file is not stored in the database. It is just a file in the file system.

            • 3. Re: Displaying an image from a file reference

              That can be done, but inserting a file or picture by reference does exactly the same thing and you don't have to script that part of the process. (And storing it by reference just stores the path without storing the actual file in the database.)


              Then you could just have a related table whith one record for each image and then clicking a line in a portal simply selects that record for view in a layout that displays the container field.


              To do exactly what you describe:


              Simply do this:


              Set Field [YourTable::YourContainerField; YourTable::YourFilePathField]


              That assumes your filepath is in exactly the format expected by filemaker. If not you may need to include the reference to YourFilePathField in an expression that includes the rest of the path. (The exact format here depends on whether this is a Mac or Windows system also.)

              • 4. Re: Displaying an image from a file reference

                I did the SetField command (see below) in an OnObjectExit of the address field and when I exit the field I end up with the string "c:\PatientImages\Creek.jpg" in the middle of the container (words not image).

                When I insert the picture manually (right click; Insert Picture; Choose Creek.jpg) it displays the picture.



                SetField[Images::Image Container; Images:Image Reference]


                - - - - - 

                OK, I got it going. I was missing the InsertImage command. When I put the path in the insert Image command (in the correct windows format) the image displayed perfectly.