3 Replies Latest reply on May 24, 2009 11:53 AM by comment_1

    Displaying a Base64 image

    grinch

      Title

      Displaying a Base64 image

      Post

      Hi Guys,

       

       I have just started working on my next project.  I haven't even gotten passed the research stage yet and I have run into a snag.  I will be receiving a base64 encoded GIF from as part of an XML response.  I will somehow need to decode it and display it on a layout and eventually print it.

       

      I have a few ideas, but nothing seems to elegant.  I have seen PHP scripts that will decode a base64 image, and I could use one of the php plugins to execute the php code to decode the image.  I also know that FireFox can display a base64 encoded image using the following tag <img src="data:image/GIF;base64,  DATA HERE">  Filmmakers web browser technology may also be able to do it.

       

      Any body else have an idea?  It feels like I always come up with solutions that are way to complicated.  There often is a way easier solution that I miss.

       

      Thanks

      Chris

       

        • 1. Re: Displaying a Base64 image
          comment_1
            

          You should be able to display base64 encoded images directly in a web viewer, using =

           

          "data:image/gif;base64," & Table::Base64Data

           

          as the address.

          • 2. Re: Displaying a Base64 image
            grinch
              

            I just tried a test, you are right it does work.  I did however run into a diferent problem when working with my sample data.  It seems that the image is encoded rotated horizontaly.  Filemaker does not offer the ability to rotate the web viewer window.  The Decoded GIF is also much larger then what I need.

             

            I am thinking of taking the Base64 data and adding html and css code to it to rotate the image, and scale it to the size I need.  Export the field data to  text file and load the text file in the web viewer.  I would do this real time as the layout with the image on it is loaded.  Even though there would be preformance issues, the base64 image needs to be refreshed every time the record is assessed since it may change.  Although this will work, I am not sure if it is the best solution.

             

            Chris

             

            • 3. Re: Displaying a Base64 image
              comment_1
                 I haven't tried this myself, but if it's possible to rotate and scale the image using HTML/CSS, it should be possible to do it directly in the web viewer using a calculated data URL - with no need to export.