sheraz Posted August 8, 2009 Share Posted August 8, 2009 sir, i m trying to design a database of a school.my question is that in the exams result section, when i enter the roll number of a student then the results should also include the image of that student. the code is successfully reading the record from table. but i want to read its picture also. how can i do this. Link to comment https://forums.phpfreaks.com/topic/169323-how-to-read-images-from-database-using-php/ Share on other sites More sharing options...
Zyx Posted August 8, 2009 Share Posted August 8, 2009 I see two solutions: 1. One script generates the HTML of the page and puts the IMG tag which points to another script. This file reads the image from the database and simply displays it with echo, sending the proper content type header earlier. 2. Put the image directly in the IMG tag, and get the image together with the student row. Displaying: echo '<img src="data:image/jpg;base64,'.base64_encode($student['image']).'" />'; However, this way is not supported properly by some browsers (especially older versions of Internet Explorer). Link to comment https://forums.phpfreaks.com/topic/169323-how-to-read-images-from-database-using-php/#findComment-893496 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.