tags:

views:

40

answers:

1

Hi I asked a similar question earlier about retrieving an image from a MySQL database Blob.

I am using code as:

header("Content-type: image/jpeg"); // change it to the right extension 
print $image;   //where image is the blob file

This code is nested inside of a webpage, so should I still modify the header? When I include the header() it removes all of the webpage code which I assume is because I am changing the file type the browser is rendering to image/jpeg? How can i show the image inside of a webpage? Thanks!

+1  A: 

You can't show an image inside a webpage (well you can, but that's a different story and probably not what you want). You need to put the code that retrieves the image from a database into a separate file, and include this file in your web page using

<img src="filename.php">
Pekka