Wednesday, April 07, 2004

Rendering Images from an XML Source

It appears that there isn't a good way to treat an image as data/content instead of a link. I was guessing this to be the case, but unless someone out there knows a way and isn't sharing.

Here is a bit for the W3C.... How about adding a tag to the XHTML spec that would enable the source to be base64 encoded version of the image (or other binary data) instead of linking? I understand that this would not be optimal for large images or for a large number of images. However, in the case that I want to protect access to an image, I could ship only that image definition to the client for rendering. That would enable XML to host all of the data instead of dividing it.

Here is what I am going to do (unless someone knows better and I find out about it). In the service that returns the XML version of the content, I'll embed each image's ID, type, size, and the image itself (in case of PDF distribution or third-party). For the HTML representation, I'll ignore the image and create a service page that will re-fetch the image using the details I send via the XML request. The last part will be linking to the service page in order to render the image. Definitely not ideal, but it will work.

No comments: