Data base images

  • Thread starter Thread starter Jeff Simmons
  • Start date Start date
J

Jeff Simmons

I have an object that has a collection of Photo in it. The Photo as
stored in the database as image type. Photo has a method that returns
the a Stream with the data so I can call System.Drawing.Image image =
System.Drawing.Image.FromStream(Photo.Stream). Now that I have an image
object how can I display it on my asp page?
Thanks
 
Hi Jeff,

You'll need a separate URL to feed this image, since ASP.NET can't stream
teh image and the HTML at the same time. Usually you should set up an HTTP
Handler (or just a page) that can feed images from the database. You then
reference this dynamic URL in your HTML returned from teh ASP.NET page.

To stream the image back use Response.OutputStream (
MyBitmap.SaveAs(Response.OutputStream); or some variation thereof).

+++ Rick ---
 
Back
Top