Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to retrieve an image from a BLOB field 1

Status
Not open for further replies.

bopritchard

Programmer
Joined
Jan 27, 2003
Messages
199
Location
US
how do i retrieve an image from a mysql db with field type BLOB?

when i

$picture=$row[4];

print"
$picture
";

i get all of the binary code returned...obviously there is something im missing...thanks
 
No, the code is working exactly as it should.

If you want to make a browser display an image, you must tell the browser that it's getting an image (by use of the "Content-type: image/jpeg" header), then output the binary data.

It's a bit of a pain, which is why I recommend that you store the image on your server's filesystem and store the filename in the database. That way, you can let the web server handle all the nitty-gritty details.

Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top