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.
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...
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>
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?
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
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.
Bookmarks