I'm looking for a way to place multiple images from a MySQL database and place them into a webpage. Every resource i've found only works on one image (while i want to display many). The jpegs are stored as BLOBS.
Here's what i've done, after setting up a connection to the DB:
/* Query the database */
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
$row = mysql_fetch_assoc($result);
$pic = $row['image']; // image is the field name where the BLOB is stored
If i change the output headers to :
header("Content-type: image/jpeg");
I can display the image by:
echo $pic;
That is good for only one image. Nothing else. I'd like to ouput multiple images and text. If i change the output headers to text/html, I will see binary output to the browser where the image should be. I'd imagine i have to convert the binary stream to a something else, or convert the binary stream to a file and do a simple <IMG SRC align="filename.jpg"> tag.
Help, please...
Here's what i've done, after setting up a connection to the DB:
/* Query the database */
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
$row = mysql_fetch_assoc($result);
$pic = $row['image']; // image is the field name where the BLOB is stored
If i change the output headers to :
header("Content-type: image/jpeg");
I can display the image by:
echo $pic;
That is good for only one image. Nothing else. I'd like to ouput multiple images and text. If i change the output headers to text/html, I will see binary output to the browser where the image should be. I'd imagine i have to convert the binary stream to a something else, or convert the binary stream to a file and do a simple <IMG SRC align="filename.jpg"> tag.
Help, please...