0

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!

longneck
  • 11,938
  • 2
  • 36
  • 44
user214285
  • 13
  • 1
  • 5
  • please properly format your code by highlighting it after you paste/type it in and press the code button in the toolbar. – longneck Nov 20 '09 at 02:51

1 Answers1

1

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
  • 442,112
  • 142
  • 972
  • 1,088