TomFromKWD Posted August 21, 2011 Share Posted August 21, 2011 Hi guys, I have a feeling the answer to this will be something incredibly simple I will be amazed I have failed to overlook but lets see. I have a database currently storing images as BLOB, it appears to be holding them fine, my upload page works fine to put images there etc The issue is coming when trying to display the images on an alternate page. I am using the code below, and it seems to recognize the field, however it is not displaying an image, it is displaying code. I have a feeling I need to add something to my headers to allow the page to show the images, but am not 100% sure. If someone could let me know what I am missing it would be great. Thanks in advance. <? include "config.php"; $query = mysql_query("Select * FROM app_images WHERE image_month='test' ") or die(mysql_error()); while ($row = mysql_fetch_array($query)) { echo " " .$row['image']. " <br /><br />";} ?> Quote Link to comment https://forums.phpfreaks.com/topic/245353-using-select-from-on-blob-files/ Share on other sites More sharing options...
Alex Posted August 21, 2011 Share Posted August 21, 2011 What you want to do is create another file that will serve the images. That file will fetch the image from the database, and output the data along with the appropriate header. Then you can use it like: <img src="image.php?id=5" alt="" /> For example, where image.php is the file that serves the image from the database. Quote Link to comment https://forums.phpfreaks.com/topic/245353-using-select-from-on-blob-files/#findComment-1260187 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.