I have a similar use case in an application and this is set to write the contents of the binary image data to a user control:
imgBytes = imgRow.ImageData.ToArray
Using mStream As New System.IO.MemoryStream(imgBytes)
Using qImg As System.Drawing.Image = System.Drawing.Image.FromStream(mStream)
Response.ContentType = mimeDict(qImg.RawFormat.Guid).MimeType
Response.BinaryWrite(imgBytes)
End Using
End Using
For your situation, though...you may be able to get away with just changing
ImgByte = CType(p.img_data, Byte())
TO
ImgByte = CType(p.img_data.ToArray, Byte())