2011-10-04 86 views
0

中讀取將頁面上的圖片上傳到fileStream。然後我把它放在一個Image對象上。如果我想在頁面上顯示此圖像,我應該遵循哪種方式?通過從Stream

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 

由於提前,

回答

1

如果要在網站上顯示圖像,我會使用通用處理程序(.ashx)讀取文件流並直接輸出到Response對象。添加緩存頭還可以防止在每個請求上讀取文件流。

克里斯

0

使用上的WinForms或類似部件將PictureBox容器web表單來顯示它。您也可以添加瀏覽器組件來顯示圖像。

相關問題