Help Displaying images of various formats on Web Form

Help Displaying images of various formats on Web Form

Post by Jeff Pta » Fri, 14 Mar 2003 02:30:43


I am having a problem getting images of various formats to
display properly in an Image control on a webform.

The images are stored in a SQL Server database.  I am
using the following technique to extract and display the
images:

I created a new ASPX page whose sole job is to get image
from the database and stream it back to the calling page.

That said, here's the steps I am going through:

1) Query the database and retrieve the image data.
2) Cast the image data to a Byte array
3) Create a MemoryStream object using the byte array
created in step 2.
4) Create a new Bitmap object from the MemoryStream
5) Set Response.ContentType = "image/<format>" where
<format> = 'gif', 'jpeg', 'tiff', 'bmp', etc...
6) Finally stream the image to the caller:  Bitmap.Save
(Response.OutputStream, ImageFormat.<format> where
<format> = one of the format options that matches the
format specified in the database for the image.

This works great for JPEG and GIF images.  However, the
TIFF and BMP images are not displayed.

I have confirmed that the images are stored in the
database in the proper format.  That is, if my database
says it's a TIFF, it's a TIFF.  This was done using the
exact same technique outlined above (with the exception
that the image source isn't an aspx page), but in a
WindowsForms application.

Am I missing something here?

Thanks!

 
 
 

1. How to display image from Web on Windows form

All the methods I've tried do not support URI encoding.

My project is a product database that is published to an e-commerce site.
I'd like to retrieve the image that is on the web site and display it on my
Windows form.

Need a method to dynamically retrieve the image and display it in my Picture
Box.

Thanks,

Pat

2. WTD:RTS/CTS serial handshaking cable

3. Need more help to display/Print TIFFs from Web Form

4. web-based look

5. Help!!! Displaying message box on a web form...

6. Microscribe 600 ? ? ?

7. Displaying a modeless form when a modal form is displayed

8. User.Identity.Name returns various formats

9. Display color formatted source code on a web page?

10. display images in button on a form in c#

11. listview does not display images, who can help?

12. Help Displaying Image?