Discussion:
Include Image bytes in HTML File How?
(too old to reply)
Chris Cooper
2003-11-06 04:36:18 UTC
Permalink
For a variety of unpleasant reasons, I need to display an image in a web
page where the image is stored in the HTML file (not in a separate GIF or
JPG or whatever file). Small image, no more than 5k or so.

It's acceptable to have the images only show up if the user is running MSIE
5 or MSIE 6 or whatever I have to require.

I would rather not require the user to install something first, though it's
not the end of the world. I could certainly build an Active/X control
myself to do this, but would rather not. If someone could point me to a
control that does this already, that would be cool.

It just seems to me, that with all the .NET and other scripting
technologies, there should be some way for me to say :
<SCRIPT>
makeImage()
{
return ASP.NET.CreateImage("0034234A5E0E8796857823085485");
}
</SCRIPT>
<IMG SRC="script:makeImage()">

Thanks all!
Chris
Igor Tandetnik
2003-11-06 15:05:47 UTC
Permalink
Post by Chris Cooper
For a variety of unpleasant reasons, I need to display an image in a web
page where the image is stored in the HTML file (not in a separate GIF or
JPG or whatever file). Small image, no more than 5k or so.
IE supports MHTML format - the format used for HTML e-mails. In this
format, HTML text and all accompanying files are stored as multipart
MIME message, and inside HTML document specially formed URLs are used to
refer to other parts of the same message. Send yourself an HTML e-mail
with an image in it and view the message source to see what I'm talking
about. Or load any web page into IE then Save As Web Archive (.mht) and
look at the resulting file in text editor.

You can use CDO objects to generate such files.
--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken
Dave Anderson
2003-11-06 18:19:01 UTC
Permalink
Have you considered SVG?
http://www.w3.org/Graphics/SVG/
Post by Chris Cooper
For a variety of unpleasant reasons, I need to display an image in a web
page where the image is stored in the HTML file (not in a separate GIF or
JPG or whatever file). Small image, no more than 5k or so.
It's acceptable to have the images only show up if the user is running MSIE
5 or MSIE 6 or whatever I have to require.
I would rather not require the user to install something first, though it's
not the end of the world. I could certainly build an Active/X control
myself to do this, but would rather not. If someone could point me to a
control that does this already, that would be cool.
It just seems to me, that with all the .NET and other scripting
<SCRIPT>
makeImage()
{
return ASP.NET.CreateImage("0034234A5E0E8796857823085485");
}
</SCRIPT>
<IMG SRC="script:makeImage()">
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
congling
2004-01-03 19:54:59 UTC
Permalink
It seems RFC2397 support your requirement, but unfortunately, IE doesn't
support this RFC.


<IMG
SRC="data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAw
AAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFz
ByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSp
a/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJl
ZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uis
F81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PH
hhx4dbgYKAAA7"
ALT="Larry">
Post by Chris Cooper
For a variety of unpleasant reasons, I need to display an image in a web
page where the image is stored in the HTML file (not in a separate GIF or
JPG or whatever file). Small image, no more than 5k or so.
It's acceptable to have the images only show up if the user is running MSIE
5 or MSIE 6 or whatever I have to require.
I would rather not require the user to install something first, though it's
not the end of the world. I could certainly build an Active/X control
myself to do this, but would rather not. If someone could point me to a
control that does this already, that would be cool.
It just seems to me, that with all the .NET and other scripting
<SCRIPT>
makeImage()
{
return ASP.NET.CreateImage("0034234A5E0E8796857823085485");
}
</SCRIPT>
<IMG SRC="script:makeImage()">
Thanks all!
Chris
Saint Jude
2004-01-04 15:33:52 UTC
Permalink
Just a thought...

When you save a webpage (in IE) as type .mht, it is saved as a multi-part
document, with the image bytes embedded in the document
just as you want.

Whether it is straightforward to serve a document with this extension I
don't know. I can't access a website today to try it.
Stick an .mht file on your server and try it out.

Also: SVG does support this kind of embedding too, but then your users will
need a SVG plugin - not such a bad thing to have though.
Post by congling
It seems RFC2397 support your requirement, but unfortunately, IE doesn't
support this RFC.
<IMG
SRC="data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAw
AAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFz
ByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSp
a/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJl
ZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uis
F81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PH
hhx4dbgYKAAA7"
ALT="Larry">
Post by Chris Cooper
For a variety of unpleasant reasons, I need to display an image in a web
page where the image is stored in the HTML file (not in a separate GIF or
JPG or whatever file). Small image, no more than 5k or so.
It's acceptable to have the images only show up if the user is running
MSIE
Post by Chris Cooper
5 or MSIE 6 or whatever I have to require.
I would rather not require the user to install something first, though
it's
Post by Chris Cooper
not the end of the world. I could certainly build an Active/X control
myself to do this, but would rather not. If someone could point me to a
control that does this already, that would be cool.
It just seems to me, that with all the .NET and other scripting
<SCRIPT>
makeImage()
{
return ASP.NET.CreateImage("0034234A5E0E8796857823085485");
}
</SCRIPT>
<IMG SRC="script:makeImage()">
Thanks all!
Chris
Loading...