Page 1 of 1

Image display problem

Posted: Tue Sep 12, 2006 10:08 am
by shey
I am trying to display an image which is stored in MySQL Database as a BLOB type. I wrote the image retrieving code in a seperate script - img.php. And I am calling this img.php in my Image command -
<img src="img.php">

I do not know why but my script - img.php is not getting called. I have seen code like this everywhere on the Net but for some reason it does not work for me.

Any help would be appreciated. Thank you

Posted: Tue Sep 12, 2006 10:13 am
by jayshields
Post your img.php code. Most likely, you have no/incorrect headers set in img.php.

Posted: Tue Sep 12, 2006 10:15 am
by ambivalent
Without seeing img.php, we have to resort to guessing. I'll go first: are you sending appropriate headers?

Code: Select all

header("Content-type: image/jpeg");

Posted: Wed Sep 13, 2006 4:27 am
by shey
Thanks guys. Got it to work right after I posted the problem. Had a little bug in the code and so was getting an error in Image display.