adam291086 Posted March 9, 2009 Share Posted March 9, 2009 I have an image being stored in a database as a medium blob data type. How can i convert this into the image with php. I am trying a simple echo but nothing <?php require_once('class/mysqldb/ez_sql.php'); $data = $db->get_results("SELECT * FROM persons",ARRAY_A); echo '<pre>'; print_r($data); echo '</pre>'; echo '<img src="'.$data["0"]["photo"].'">'; ?> you can see whats happening here http://www.adamplowman.com/CASE/test.php Link to comment https://forums.phpfreaks.com/topic/148628-print-out-an-image-source-stored-as-mediumblob-in-a-database/ Share on other sites More sharing options...
waynew Posted March 9, 2009 Share Posted March 9, 2009 <?php require_once('class/mysqldb/ez_sql.php'); $data = $db->get_results("SELECT * FROM persons",ARRAY_A); header("Content-type: image/jpeg"); //or gif whatever echo '<img src="'.$data["0"]["photo"].'">'; ?> Link to comment https://forums.phpfreaks.com/topic/148628-print-out-an-image-source-stored-as-mediumblob-in-a-database/#findComment-780477 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.