Click to See Complete Forum and Search --> : converting blob data to am image


tlavalle
07-26-2006, 08:34 AM
How can i convert the data in a blob to an image to display on a dynamic page?

NogDog
07-26-2006, 10:08 AM
One way would be to write a separate "image server" page. It would be passed the key field value for the desired image in the URL query string. It would then query the DB for the image by using that ID. If found, it would send a header() specifying the appropriate content-type, then echo the data retrieved from the blob field. (If not found in the DB, you could send a 404 header.) Therefore the main page would just output an image element such as echo '<img src="/images/display.php?img_id=$imgId">'; (where display.php is the image server PHP script and $imgId is the ID of the desired image).