Show Images to the page by reading from Stream

0

I upload an image to a fileStream. Then I put it on a Image object. If I want to show this image to the page, which way should I follow ?

System.Drawing.Image image = System.Drawing.Image.FromStream(file.InputStream))

**IMMEDIATE WINDOW**
image
{System.Drawing.Bitmap}
    [System.Drawing.Bitmap]: {System.Drawing.Bitmap}
    base {System.MarshalByRefObject}: {System.Drawing.Bitmap}
    Flags: 0x00013012
    FrameDimensionsList: {System.Guid[0x00000001]}
    Height: 0x0000012f
    HorizontalResolution: 95.9865952
    Palette: {System.Drawing.Imaging.ColorPalette}
    PhysicalDimension: {Width = 988.0 Height = 303.0}
    PixelFormat: Format32bppArgb
    PropertyIdList: {int[0x00000005]}
    PropertyItems: {System.Drawing.Imaging.PropertyItem[0x00000005]}
    RawFormat: {[ImageFormat: b96b3caf-0728-11d3-9d7b-0000f81ef32e]}
    Size: {Width = 0x000003dc Height = 0x0000012f}
    Tag: null
    VerticalResolution: 95.9865952
    Width: 0x000003dc

Thanks in advance,

c#
.net
filesystems
inputstream

2 Answers

1

If you want to display image on a website, I would use a Generic Handler (.ashx) to read file stream and output directly to Response object. Adding cache headers would also prevent from reading file stream on every request.

Kris

answered on Stack Overflow Oct 4, 2011 by Drakkonite • edited Oct 4, 2011 by Drakkonite
0

Use a picturebox container on winforms or similar component for webforms to display it. You also can add browser component to display image.

answered on Stack Overflow Oct 4, 2011 by Zenwalker

User contributions licensed under CC BY-SA 3.0