Embedding an image in the html?

G

Guest

Hi;

Is there a way to embed images in the response rather than writing them to
disk and having an <img ...> tag? And if so, how is it done and what browsers
support it?
 
E

Edwin Knoppert

You are unclear about the actual problem.
It's easy to substitute the SRC="" behaviour in ASP.NET and simply stream an
image to the user.
The stream data is up top you.

Be clear..
 
B

Bruce Barker

yes, for browsers like mozilla, firefox, opera and safari that implement rfc
2397, you can include the image in as a base64 encoded. IE does not support
rfc 2397.

<img src="data:image/gif;base64,<base64 encoded image>">


-- bruce (sqlwork.com)
 
G

Guest

Right - and that src="anotherasp/image.png" can be handled by me.

But I was wondering if I could add the image to the response that contains
the html - like a MIME email message. That way I don't have to track images
that will be requested shortly and also determine when to dispose of them.
 
G

Guest

Oh wow - this is great. Too bad IE doesn't do this also but we can work based
on browser type. By any chance do you know what version of each it is
supported in?
 
B

Bruce Barker

i believe these are the correct versions

opera 7.2 +
safari 1.2 +
firefox 1.0 +
mozilla (2003+)

-- bruce (sqlwork.com)
 
E

Edwin Knoppert

Is this for dynamically generated images (which evt. differ between users)?
Then i can imagne..
 
S

Steven Cheng[MSFT]

Hi Dave,

IMO, I don't quite recommend using the
<img src="data:image/gif;base64,<base64 encoded image>">

since it's not a standard feature in html, also making image binary mixed
with html content will cause the main page's size increase extremely.....
I'd suggest you consider building an ASP.NET httphandler which help
retrieving image stream from different soruce (database, file system, or
dynamically through GDI+ code) and write them out as a single image stream
... Thus, any other pages can use <img src=xxxx> to reference that
httphandler's url.... here is


#A simple ASP.NET photo album
http://weblogs.asp.net/bleroy/archive/2005/09/08/424714.aspx

#Using ASP.NET HTTP Handlers to create a photo album
http://www.microsoft.com/belux/nl/msdn/community/columns/desmet/httphandler.
mspx

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Bruce Barker" <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: Embedding an image in the html?
| Date: Fri, 23 Dec 2005 12:57:19 -0800
| Lines: 52
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: rdcsd1.safeco.com 12.144.134.2
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:366857
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| i believe these are the correct versions
|
| opera 7.2 +
| safari 1.2 +
| firefox 1.0 +
| mozilla (2003+)
|
| -- bruce (sqlwork.com)
|
| | > Oh wow - this is great. Too bad IE doesn't do this also but we can work
| > based
| > on browser type. By any chance do you know what version of each it is
| > supported in?
| >
| > --
| > thanks - dave
| >
| >
| > "Bruce Barker" wrote:
| >
| >> yes, for browsers like mozilla, firefox, opera and safari that
implement
| >> rfc
| >> 2397, you can include the image in as a base64 encoded. IE does not
| >> support
| >> rfc 2397.
| >>
| >> <img src="data:image/gif;base64,<base64 encoded image>">
| >>
| >>
| >> -- bruce (sqlwork.com)
| >>
| >>
| >>
| >> | >> > Hi;
| >> >
| >> > Is there a way to embed images in the response rather than writing
them
| >> > to
| >> > disk and having an <img ...> tag? And if so, how is it done and what
| >> > browsers
| >> > support it?
| >> >
| >> > --
| >> > thanks - dave
| >>
| >>
| >>
|
|
|
 

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
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top