|
Posted by Edward on January 28, 2006, 5:52 am
Please log in for more thread options
Jukka K. Korpela wrote:
> Edward wrote:
>
> > I have been doing some research about embedding images in HTML using
> > the data URL src method of the format:
>
> Have you studied the specification of data: URLs and the browser support
> to them?
>
I am trying to learn all I can about the data: URL. Clearly I am not
yet an expert! But I hope to learn from others in this forum and in my
other research. I am trying to progress.
> > <img src="/-/data:image/gif;base64,<DATA>">
>
> Apparently not. And your markup isn't even valid.
>
How so? I have been able to open images in browsers using this markup.
I found some good examples at:
http://delegate.org/delegate/sample/data-url.html.
> Besides, even if you got it right, and even if browsers generally
> supported it (say, in 2009), would it still be _useful_ to use it?
>
I hope so. I am not going to use it in the browser, per se, however.
I plan to use it to pass a parameter to Apache FOP to load an
external-graphic. I need to use a data: URL because the image
generation servlet is required to use HTTPS and FOP does not seem to
support HTTPS in an external-graphic.
> > My question is, how does one generate this <DATA> string?
>
> It's too early to ask that, since you haven't addressed the more
> fundamental issues. Besides, it's not an HTML issue.
I have found a web site to encode data to Base64
(http://makcoder.sourceforge.net/demo/base64.php) and a class that
someone wrote
(http://www.source-code.biz/snippets/java/Base64Coder.java.txt). Using
both of these methods, I took the sample <DATA> from above (which
created the image in a browser) and then saved this image. I then used
the two methods here to try to recreate the <DATA>. The recreated
<DATA> was close but not the same as the original. I think that I must
be missing something obvious on how to create the Base64 data.
|