Jump to content

how to read images from database using php


sheraz

Recommended Posts

:(

 

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.

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).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.