Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to display a image from a Database

Status
Not open for further replies.

Kenos

Programmer
Jul 21, 2002
28
US
Hello All,

I am having a issues with trying to display a image that has been saved to my database.

Here is the code that I am trying to use.

Can any one help??

Dim ID
Dim sSQL
Dim oRS
Dim Field
Dim FileLength

ID = Request.QueryString("ID")
Response.ContentType = "image/gif"
sSQL = "SELECT image_blob, filesize FROM UserImages WHERE UserID =" & ID
Set oRS = getRS(sSQL)
oRS.MoveFirst
Set Field = oRS("Image_blob")
FileLength = oRS("filesize")

Response.BinaryWrite Field.GetChunk(FileLength)

oRS.Close
 
what is the error or what is the results when you run it?? ---------------------------------------
{ str = "sleep is good for you. sleep gives you the energy you need to function";
ptr = /sleep/gi;Nstr = str.replace(ptr,"coffee");alert(Nstr); }

 
Thanks for the Reply,

There is no errors it just shows,

?ùƒÉu¸&quot;ÄèÀ‚î&quot;¸ÑèH¼±E ³Û¡#_e` ¾)8€18³F߈ãcáXqM$H™€ÉPªä8ÖÁ­2ÖuÆNO0–YDpÍÅo*L=Hôþ¾ÚÑí<ÈëSOŽØÝB ?—™Š¶)=DžV µ¤åíq œ™=// bÂËA_d˜ÎÖ×ϱ¤‰¸~QYU§—(.

This is only part if it,
 
[lol] don't you love it when it does that

this means the binarywrite is not valid
write the oRS(&quot;filesize&quot;) to the screen and check for the value to be acurate
---------------------------------------
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }

 
Thanks Again for your Reply,

Ok Added,
FileLength1 = Field.ActualSize
FileLength = oRS(&quot;filesize&quot;)

To check to see if they were both the same
They match,

I can write the oRS(&quot;Image_blob&quot;)
To a file and it shows fine,
Humm I am stumped
 
Try writing it without the GetChunk method, and make sure you don't have any dead space before or after your ASP script tags:
Code:
<% <--- no space before
   <--- code
%> <--- no space after

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
No more vacation for me :(

FAQ FAQ20-2863
= new Forums.Posting.General.GettingAnswers()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top