Image display problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shey
Forum Newbie
Posts: 2
Joined: Tue Sep 12, 2006 9:54 am

Image display problem

Post 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
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

Post your img.php code. Most likely, you have no/incorrect headers set in img.php.
User avatar
ambivalent
Forum Contributor
Posts: 173
Joined: Thu Apr 14, 2005 8:58 pm
Location: Toronto, ON

Post 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");
shey
Forum Newbie
Posts: 2
Joined: Tue Sep 12, 2006 9:54 am

Post 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.
Post Reply