Forums

This topic is locked

Retreive Image From BLOB??

Posted 07 Feb 2002 20:05:52
1
has voted
07 Feb 2002 20:05:52 Peter R posted:
Hello,

I've managed to get images into BLOB fields in my MySQL database, but now am
not sure how to display them dynamically on a detail page.

I tried displaying the image using the method of placing an image on the
page and then binding it to the correct field in the database. But this must
only work if you store a simple image path in the field. Right now when I
use this method, it displays a dynamic image icon on my page, but when the
page is viewed online, the only thing displayed is a HUGE chunk of Text
where the image should be.

How can I display an image from a BLOB field dynamically on a Detail page,
along with all the other data from the Recordset??

I'm using MySQL/PHP

Thank you kindly!

Peter

Replies

Replied 08 Feb 2002 10:19:36
08 Feb 2002 10:19:36 Bruno Mairlot replied:
My suggestion would be to use a separate process...

Why ? Because, when a browser request for a page, you will need to put the src of your dynamic image in your HTML code...

When the browser detect the <img> tag, it will launch another process to download that image.

My suggestion would be to use the following :

The image tag : <img src="/getimage.php?imageID=23"> (23 is taken from the database, and is the ID of the row containing your BLOB

Where getimage.php, will do the following :

1. Get the BLOB content into a var
2. Send the Content-Type: image/gif (jpg or png depending on the type)
3. Output the blob content with a print $blob


You should try the getimage.php directly within your browser, without using the whole HTML file. Just make sure you can show an image right into a HTTP process, then when this is working, just add the URL in your big HTML file.

--- Better to die trying, than never try at all ---
Replied 24 Oct 2006 20:54:10
24 Oct 2006 20:54:10 Jason Bean replied:
<font face='Verdana'>Anyone know how to do this with SQL and ASP.NET VB page?</font id='Verdana'>

DW8 / ASP.NET VB / SQL

Reply to this topic