lillizzierae Posted September 10, 2007 Share Posted September 10, 2007 I'm learning php and sql right now. I'm doing my final and one part of my final says I should pull images from the database. How exactly do i pull images from the database? Link to comment Share on other sites More sharing options...
justsomeguy Posted September 10, 2007 Share Posted September 10, 2007 The same way you get any other data, with a select statement. The difference is how you display the data, you can't just print out binary image data to see the image. First you need to send the browser a content-type header that says what kind of data it is (what kind of image), and then you can print the data from the database. The browser will see the content-type header and interpret the following data as the data for that image.When you store an image in the database, the data you want to store is the data you get by using fread or file_get_contents on the image file. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.