image from within document itself

A

Asterbing

How to display image data embedded in the html page itself. Seen <img
src:"data:image/gif;base64,...">, but it doesn't work in IE. How to do ?
What workaround ?
 
D

David Dorward

Asterbing said:
How to display image data embedded in the html page itself.

Use data URLs.
Seen <img src:"data:image/gif;base64,...">, but it doesn't work in IE.
Correct.

What workaround ?

There isn't one. Use an external resource.
 
J

Jim Higson

Asterbing said:
How to display image data embedded in the html page itself. Seen <img
src:"data:image/gif;base64,...">, but it doesn't work in IE. How to do ?
What workaround ?

Those are data URLs. There is no workaround to get them showing in IE,
except to fall back on 'normal' http URLs.
 
A

Alan J. Flavell

Those are data URLs.

Quite suitable for small images, but a bit wasteful of space for
larger ones[1]
There is no workaround to get them showing in IE,
indeed

except to fall back on 'normal' http URLs.

You could use conditional comments, so that compatible client agents
"see" only the embedded data, and don't have to make an additional
HTTP transfer, whereas the operating system component that thinks it's
a web browser will perceive the external link instead.

If you cared enough, that is.

regards

[1] Most current browsers support gzipped HTML, so feel free to
offer pages in that format if you'd like to conserve space and
bandwidth. Or use mod_gzip to negotiate it.
 
A

Asterbing

How to display image data embedded in the html page itself. Seen <img
src:"data:image/gif;base64,...">, but it doesn't work in IE. How to do ?
What workaround ?

Well, thanks David, Jim and Alan, but it seems it's a no way problem.
Elsewhere, I've seen some solutions going with <OBJECT> or XBM
conversion or MIME encapsulation... But I think I'll go to something
easier like a POST (afraid of GET because of lengh url limitation,
knowing my largest images may be of 10KB, while smallest 50 bytes) of
the image data toward a cgi which will sent it back to browser in tne
framework of an <img> tag.
 
J

Jim Higson

Asterbing said:
Well, thanks David, Jim and Alan, but it seems it's a no way problem.
Elsewhere, I've seen some solutions going with <OBJECT> or XBM
conversion or MIME encapsulation... But I think I'll go to something
easier like a POST (afraid of GET because of lengh url limitation,
knowing my largest images may be of 10KB, while smallest 50 bytes) of
the image data toward a cgi which will sent it back to browser in tne
framework of an <img> tag.

It's not clear what you're trying to do. Care to share?
 
A

Asterbing

It's not clear what you're trying to do. Care to share?

Not clear because not written what I've in mind yet, so you've just get
my idea how it is at the moment I'm posting.

If I did choosen the GET way, it would be something easy like : <img
src='display_image.cgi?$img_data'>, but sure I'll be not able to pass
binary data (even base64 encoded) like this in url... Then, I'll try to
do it like a form POST will do...

Not sure it will work, not done at this time
 
T

Toby Inkster

Asterbing said:
How to display image data embedded in the html page itself. Seen <img
src:"data:image/gif;base64,...">, but it doesn't work in IE. How to do ?
What workaround ?

Yes, it can be done. You'll need:

1. A small server-side script that can do base64 decoding;

2. A small client-side script that Internet Explorer will
run, that performs the following tasks:

* Finds all data:URLs
* For each of them, rewrites it to point to
the server-side script, calling it using the
base64-encoded data as a parameter.

e.g.
http://dean.edwards.name/weblog/2005/06/base64-ie/
http://www.kryogenix.org/days/2003/10/18/embedding

Reminds me -- I keep meaning to add "data:" URLs to my chess board.

http://examples.tobyinkster.co.uk/chess/
 
J

Jim Higson

Asterbing said:
Not clear because not written what I've in mind yet, so you've just get
my idea how it is at the moment I'm posting.

If I did choosen the GET way, it would be something easy like : <img
src='display_image.cgi?$img_data'>, but sure I'll be not able to pass
binary data (even base64 encoded) like this in url... Then, I'll try to
do it like a form POST will do...

You certainly can pass data from the client to the server as a POST request.
There is no absolute max length a GET request can post in the URL, but most
apache servers have an 8k limit compiled in (you can have more, but you
have to recompile)

I have library code to do it both ways for an open source project I made.
Interested?
 
A

Asterbing

I have library code to do it both ways for an open source project I made.
Interested?

Not sure to understand what you mean, Jim, but obviously interested to
see closer. Do you have an url ? Or, if you prefer, here is an antispam
email I've created these days : (e-mail address removed). Thanks
 
A

Asterbing

usenet200604 said:
Yes, it can be done. You'll need:

1. A small server-side script that can do base64 decoding;

OK, no pb about that (MIME::Base64 in Perl)
2. A small client-side script that Internet Explorer will
run, that performs the following tasks:

* Finds all data:URLs
* For each of them, rewrites it to point to
the server-side script, calling it using the
base64-encoded data as a parameter.

And what if base64-encoded image data langth is over the url query
string limitation ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top