R
Ratman
I have a class that streams an image from a DB. If there is no image
(record then I want the class to stream a default image.
Why is this not working? It is breaking on the line of code within
the for..loop. Any help would be greatly appreciated.
bImageBinaryData is a Byte()
Thanks.
Dim oHttpContext As HttpContext
Dim sPhysicalFilePath As String =
oHttpContext.Current.Server.MapPath("../images/img-CategoryThumb.gif")
sImageName = ""
sImageContentType = ""
Dim fsDefaultThumbnail As New FileStream(sPhysicalFilePath,
FileMode.Open, FileAccess.Read)
Dim brDefaultThumbnail As New BinaryReader(fsDefaultThumbnail)
Dim iCounter As Long
Dim baDefaultThumbnail As Byte()
For iCounter = 0 To fsDefaultThumbnail.Length
baDefaultThumbnail(CType(iCounter, Integer)) =
brDefaultThumbnail.ReadByte
Next
fsDefaultThumbnail = Nothing
brDefaultThumbnail = Nothing
bImageBinaryData = baDefaultThumbnail
(record then I want the class to stream a default image.
Why is this not working? It is breaking on the line of code within
the for..loop. Any help would be greatly appreciated.
bImageBinaryData is a Byte()
Thanks.
Dim oHttpContext As HttpContext
Dim sPhysicalFilePath As String =
oHttpContext.Current.Server.MapPath("../images/img-CategoryThumb.gif")
sImageName = ""
sImageContentType = ""
Dim fsDefaultThumbnail As New FileStream(sPhysicalFilePath,
FileMode.Open, FileAccess.Read)
Dim brDefaultThumbnail As New BinaryReader(fsDefaultThumbnail)
Dim iCounter As Long
Dim baDefaultThumbnail As Byte()
For iCounter = 0 To fsDefaultThumbnail.Length
baDefaultThumbnail(CType(iCounter, Integer)) =
brDefaultThumbnail.ReadByte
Next
fsDefaultThumbnail = Nothing
brDefaultThumbnail = Nothing
bImageBinaryData = baDefaultThumbnail