10 Replies Latest reply on Jul 21, 2014 5:37 PM by keywords

    Insert Picture vs Set Field

    analistamarcio

      Hi,

       

      I have a solution to crop images.

      The containers fields store the images externally (one secure and other open).

      By the web viewer + javascript + external plug-in, I can make the images crop.

      If I use the script step "Set Field" to copy a image from a field to the other field (the open container field to secure container field), the image attributes (width and height) doesn't changed.

      I use the script step GetWidth and GetHeight to read this image attributes.

      If I use the script step "Insert Picture" to do this same operation, the image attributes are updated correctly.

      Do I have some procedure wrong or I found some bug?

       

      //-- Using Set Field script step:

      Set Field [ Table1::Photo; Table1::PhotoTEMP ]

       

      //-- Using Insert Picture script step:

      Set Variable [ $PhotoTEMPnew; Value:$$Photo ]

      Go to Field [ Table1::Photo ]

      [ Select/perform ]

      Insert Picture [ “$PhotoTEMPnew” ]

       

      Thank you,

      Marcio Nunes.

        • 1. Re: Insert Picture vs Set Field
          taylorsharpe

          Have you exported the picture both ways and opened another program that lets you see the meta data to confirm?  It could be that your process is not sticking the same picture in at the same size.  But then again, it could be a bug.  Just confirm the sizes outside of FileMaker first. 

          • 2. Re: Insert Picture vs Set Field
            wimdecorte

            What's in the $$photo variable?  How is that one set?

            • 3. Re: Insert Picture vs Set Field
              analistamarcio

              Hi, Taylor.

               

              I confirmed with Photoshop.

              After crop the image, the external stored file opned by Photoshop, show the correct image attributes, but the FileMaker shows wrongs attributes.

               

              Thanks,

              Marcio Nunes.

              • 4. Re: Insert Picture vs Set Field
                analistamarcio

                Hi, wimdecorte!

                 

                Please, ignore that pass of scrip... there are some pass before to valid the current platform and adjust the $$photo variable.

                Something like this:

                 

                If [ Get ( SystemPlatform ) = -2 ]

                      Set Variable [ $$photo; Value:Substitute ( $$photo; "file:/"; "imagewin:/") ]

                End If

                 

                Thanks,

                Marcio Nunes.

                • 5. Re: Insert Picture vs Set Field
                  wimdecorte

                  I don't think it should be ignored, not until we know for sure.  Are you trying to import from the location that you specified in the Remote Container feature?

                  • 6. Re: Insert Picture vs Set Field
                    analistamarcio

                    Hi, wimdecorte.

                     

                    I have been used the script step "GetAsText" and "Substitute" to remove the word "remote:/" and complete the correct external file path.

                     

                    Marcio Nunes.

                    • 7. Re: Insert Picture vs Set Field
                      keywords

                      Re: "Photoshop, show the correct image attributes, but the FileMaker shows wrongs attributes": I think you can safely assume that FM will show the correct atttributes for the image it is storing, so if these are not what you expect you ought to assume you have the wrong image in there, and find out why, which will lead you to a solution.

                       

                      On a different line of thought, although not addressed in your post (nor does it need to be of course) I assume you have some sound reason for wanting to crop the images themselves. I trust, however, that you are not doing so solely for purposes of display within FM, as this can be achieved in other ways. The attached screenshot shows two instances of the sae container; the upper one is configured to display the whole image with proportions maintained, the lower one is set to crop the image to display the upper middle portion only. Remeber, too, that in FM 12/13 allow FM to generate thumbnails means it will gnereate whatever size thumbnail it neads to display an image in each container on a layout.

                       

                      Screen Shot 2014-07-21 at 9.50.32 am.png

                      • 8. Re: Insert Picture vs Set Field
                        PalmDBS

                        I have confirmed the same result (secure container shows cropped image but has height/width attributes of the original image in the open container).  I would guess that the image attributes are being cached the first time that the image is placed, and hence copied straight over without re-evaluation when you Set Field equal to the first (open) container. 

                         

                        I originally would've thought that the GetWidth and GetHeight command would evaluate on the container image at the time the script step is run, but that appears to not be the case.

                        • 9. Re: Insert Picture vs Set Field
                          analistamarcio

                          May be I found the wrong way...

                          When I change the external file, by Photoshop, Paint, iPhoto, or, in my solution, by external plug-in, the container field stayed "Tampered".

                          In this case, if we use the script step Set Field, the FM doesn't "detect" outcome error. It's necessary, in this case, use the script step Insert Picture.

                          When I was using the script step Set Field, in fact, the container target field wasn't have been changed (and not have been the cached image).

                          Followed the file help me reaching this conclusion.

                          Thanks all for the help.

                           

                          Marcio Nunes.

                          • 10. Re: Insert Picture vs Set Field
                            keywords

                            Re "When I change the external file, by Photoshop, Paint, iPhoto, or, in my solution, by external plug-in, the container field stayed "Tampered""

                             

                            If you get the "tampered" warning in FM then you are definitely going about things the wrong way. Accessing externally stored images, other than via FM, is a real No No since the advent of external storage. If you need to change an image you have stored the correct way is to EXPORT the image, make the necessary changes in whatever native software you need to use, then IMPORT the changed image. The new/altered image will automatically replace the one currently stored. It sounds as if you wish to do this with your solution, so you should put some effort into creating a scripted process to facilitate this.