Eclipse DevSoft
Feb 1st, 2000, 10:24 AM
I tried using all the codes that I can find on MSDN regarding displaying an image stored on the database but the images doesn't show properly. It seems you need to store the images as RAW, which means no header. Does somebody know how to retrieve the picure data part or the position of the byte where the picture data begins? Or does someboby have a better idea on how to display the images (either GIF or JPEG) Im Using this code:
oCnn = Server.CreateObject("ADODB.Connection")
oCnn.OPen "DNS=LocalServer;UID=SA;PWD=;Database=MyData"
sSQL = "SELECT ImgType, Photo FROM InvTable WHERE SKU = '123456'"
oRS = oCnn.Execute(sSQL)
PicType = ImgType
PicSize = rs("Photo").ActualSIze
Pic = rs("Photo").GetChunk(PicSize)
Response.ContentType = "image/" & PicType
Response.BinaryWrite Pic
Response.End
see, The PicType will either be "GIF" or "JPEG", I know I stored the image properly because when I dump it to a file, it displays properly on IE or other Image processing tools.
If you have a better code or idea, please help. Thank you very much.
------------------
Share your knowledge, it is the best way to achieve immortality
oCnn = Server.CreateObject("ADODB.Connection")
oCnn.OPen "DNS=LocalServer;UID=SA;PWD=;Database=MyData"
sSQL = "SELECT ImgType, Photo FROM InvTable WHERE SKU = '123456'"
oRS = oCnn.Execute(sSQL)
PicType = ImgType
PicSize = rs("Photo").ActualSIze
Pic = rs("Photo").GetChunk(PicSize)
Response.ContentType = "image/" & PicType
Response.BinaryWrite Pic
Response.End
see, The PicType will either be "GIF" or "JPEG", I know I stored the image properly because when I dump it to a file, it displays properly on IE or other Image processing tools.
If you have a better code or idea, please help. Thank you very much.
------------------
Share your knowledge, it is the best way to achieve immortality