Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Determine image type from Base64 string

Options
  • 27-03-2008 1:18pm
    #1
    Registered Users Posts: 2,931 ✭✭✭


    Hi

    I have an XML file that will contain images in Base64 encoded format. I am currently able to reconstruct them as images fine, but i am only testing with JPGs at the moment. Further down the road there will be different types such as PNG and GIF

    Is there a way to asses what type of image from the string as in is there a control set that tells you what it is?

    What I am doing is converting InfoPath 2007 forms to XHTML using the XML and XSL file contained within the XSN file. The XML file contains the image encoded as a Base64 string

    Ta


Comments

  • Closed Accounts Posts: 1,567 ✭✭✭Martyr


    could you decode a few bytes of the base64 encoded image and check the header for PNG/JPEG or GIF ???

    the first few bytes are usually header.


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Its loaded into a byte array before writing so I am sure I can..

    I am looking to see if its possible before investing some time into it


  • Registered Users Posts: 2,426 ✭✭✭ressem


    The info here might help to recognise what you're looking for.

    http://www.mikekunz.com/image_file_header.html


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    I will have a whack at it and see what happens


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    ressem .. thanks for that infomation.. does exactly what I want..

    Again thanks muchly


  • Advertisement
Advertisement