www.webdeveloper.com
Results 1 to 9 of 9

Thread: XML-code for images

Hybrid View

  1. #1
    Join Date
    Feb 2009
    Posts
    4

    XML-code for images

    I've tried to seached the forum, I couldn't find similar threads, but I suppose it is. So please re-direct me to other threads.

    Okey, here's my question, how can I find the XML to a picture? And, yes, I mean XML, not HEX, XSLT or anything else.

    Example:

    http://www.webdeveloper.com/forum/im...bdev-logo2.gif

    As said, that image is just an example, but let's use it, how can I find the XML for that image? I've tried using HEX Viewer, but that didn't help at all, I've tried open a Wordpad, save it as .xml, and put a image in, but that doesn't work either.

    Did I explain dificult or do you understand?

    Thanks in advance.
    Attached Images Attached Images

  2. #2
    Join Date
    Sep 2008
    Location
    Canada
    Posts
    246
    Images are made up of binary data... not sure exactly why you want to convert it to xml... you can store its address and dimensions into xml fields... sure...
    Web Jesters - The Masters of Multitasking.

  3. #3
    Join Date
    Feb 2009
    Posts
    4
    Quote Originally Posted by FourCourtJester View Post
    not sure exactly why you want to convert it to xml... you can store its address and dimensions into xml fields... sure...

    Well, it's for personal use. Can you teach me how too store the addresses and dimensions into XML fields?

  4. #4
    Join Date
    Sep 2008
    Location
    Canada
    Posts
    246
    well, a typical xml document will look similar to a simple html document. you will have tags, and within those tags will be options. The trick to xml, however, is tags and options can be anything you desire, not set in stone like html.

    An example xml compilation for an image could be something like this:

    Code:
    <?xml version="1.0">
    <image>
       <src>the url to the image</src>
       <height> image height in pixels</height>
       <width> image width in pixels</width>
       <title> whatever title you want for the image</title>
    </image>
    More information can be found at http://www.w3schools.com/xml/default.asp
    Web Jesters - The Masters of Multitasking.

  5. #5
    Join Date
    Jun 2014
    Posts
    2

    for image and images downloading from website what are the tag or syntax used.

    In XML Program for image and multiple images downloading from website


    Which tag and syntax used

  6. #6
    Join Date
    Feb 2009
    Posts
    4
    That's a bit advanced for me .. is their a possibility that you could "convert" some images into XML for me, possibly if you have a e-mail I contact you on?

    That would mean much too me.

  7. #7
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    You'll want to Base64 encode the images. What sort of scripting do you have available?
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  8. #8
    Join Date
    Feb 2009
    Posts
    4
    I have Base64, but don't know how do use it with images.

  9. #9
    Join Date
    May 2008
    Posts
    381
    Quote Originally Posted by The Bird View Post
    I have Base64, but don't know how do use it with images.
    You would read the binary data and encode the data in base64. The data would then be placed into an XML document, such as:
    Code:
    <image>
      <src>/images/black_1x1.gif</src>
      <width units="pixels">1</width>
      <height units="pixels">1</height>
      <description>A black dot.  Size: 1px x 1px.</description>
      <data>R0lGODlhAQABAPcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgMDAwP8AAAD/AP//AAAA//8A/wD//////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMwAAZgAAmQAAzAAA/wAzAAAzMwAzZgAzmQAzzAAz/wBmAABmMwBmZgBmmQBmzABm/wCZAACZMwCZZgCZmQCZzACZ/wDMAADMMwDMZgDMmQDMzADM/wD/AAD/MwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMzADMzMzMzZjMzmTMzzDMz/zNmADNmMzNmZjNmmTNmzDNm/zOZADOZMzOZZjOZmTOZzDOZ/zPMADPMMzPMZjPMmTPMzDPM/zP/ADP/MzP/ZjP/mTP/zDP//2YAAGYAM2YAZmYAmWYAzGYA/2YzAGYzM2YzZmYzmWYzzGYz/2ZmAGZmM2ZmZmZmmWZmzGZm/2aZAGaZM2aZZmaZmWaZzGaZ/2bMAGbMM2bMZmbMmWbMzGbM/2b/AGb/M2b/Zmb/mWb/zGb//5kAAJkAM5kAZpkAmZkAzJkA/5kzAJkzM5kzZpkzmZkzzJkz/5lmAJlmM5lmZplmmZlmzJlm/5mZAJmZM5mZZpmZmZmZzJmZ/5nMAJnMM5nMZpnMmZnMzJnM/5n/AJn/M5n/Zpn/mZn/zJn//8wAAMwAM8wAZswAmcwAzMwA/8wzAMwzM8wzZswzmcwzzMwz/8xmAMxmM8xmZsxmmcxmzMxm/8yZAMyZM8yZZsyZmcyZzMyZ/8zMAMzMM8zMZszMmczMzMzM/8z/AMz/M8z/Zsz/mcz/zMz///8AAP8AM/8AZv8Amf8AzP8A//8zAP8zM/8zZv8zmf8zzP8z//9mAP9mM/9mZv9mmf9mzP9m//+ZAP+ZM/+ZZv+Zmf+ZzP+Z///MAP/MM//MZv/Mmf/MzP/M////AP//M///Zv//mf//zP///yH5BAEAABAALAAAAAABAAEAAAgEAFEEBAA7
    </data>
    </image>
    Of course, yours would most likely be considerably longer since that is for a 1x1 black GIF image. If all you're trying to do is store the image, then that's it; you're finished. If you actually want to display it in a browser, then you would use XSLT, mapping image/src in your XML document to img/@src in your transformation. That would essentially make the data useless unless you planned to use it for another purpose.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles