Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending an image from a byte array 1

Status
Not open for further replies.

theoxyde

Programmer
Jul 16, 2003
220
US
I have images that need to be passed to the client without referencing a static image file. These images are created dynamically and are byte arrays. I can convert these to whatever form they need to be in, except a static file.

What is my best option for embedding these images (PNG format) in a page sent to the client? I've thought about referencing another aspx page in the <IMG> tag that builds the image and returns it with an adjusted MIME type.

Am I on the right track, or is there an easier way to return an image without referencing a static file?
 
theo: My first guess is to have the images created dynamically by individual <img> links - in all my aspx pages in which I send dynamically created *.png files the <img> tags call for the aspx pages that create the files (these images are generally on the order of 2-4K).

This is not to suggest that this is the best way to send dynamic images; only a method that has worked flawlessly for me for over a year.
 
Okay, that ended up being much less difficult than I anticipated. The individual aspx generated image was what I was looking for.
Code:
Response.ContentType = &quot;image/png&quot;;
Response.OutputStream.Write( output, 0, output.Length );
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top