Hi
I'm looking for a way to display a 'png' file from a local drive to a web page.
I have this streaming method, reading image file is not an issue, but it just won't display it.
Any advice? Thanks.
I'm looking for a way to display a 'png' file from a local drive to a web page.
I have this streaming method, reading image file is not an issue, but it just won't display it.
Any advice? Thanks.
VB.NET:
Public Function ConvertToByteArray(ByVal value As Bitmap) As Byte()
Dim bitmapBytes As Byte()
Using stream As New System.IO.MemoryStream
value.Save(stream, System.Drawing.Imaging.ImageFormat.Png)
bitmapBytes = stream.ToArray
End Using
Return bitmapBytes
End Function
Private Sub displayMap()
Dim oBmp As Bitmap
oBmp = New Bitmap(m_strAppPath & "\" & m_LotNo & "_" & m_SlotNo & "_" & m_Surface & IMAGE_TYPE)
Dim bitmapBytes As Byte() = ConvertToByteArray(oBmp)
Response.ContentType = "image/png"
Response.OutputStream.Write(bitmapBytes, 0, bitmapBytes.Length)
Response.OutputStream.Flush()
Response.End()
End Sub