By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,985 Members | 1,830 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,985 IT Pros & Developers. It's quick & easy.

How to use PHP file in src tag of img?

P: 3
Hi, i want to use php file in src tag of image tag.

For example: i want to give the file name in the src tag of image as show below
<img src="image.php">

In image.php file, i have echo the image named abc.jpg.SO, when i run the file, image.php, i am able to see the image

But when i run the other file in which <img src="image.php"> is there, then i am not able to see the image, what shoudl i do in order to display the image?
Oct 24 '11 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 5K+
P: 8,639
there could be a processing error in PHP, the script could be in another place, the MIME headers could be wrong (rather improbable).

have you cleared the cache?
Oct 24 '11 #2

P: 3
what code should we do write in image.php?
Oct 24 '11 #3

P: 3
header("Content-type: image/jpeg");
$image = "image.jpg";
echo file_get_contents("$home/support/img/$image");

it works but when i send the email, google reads that it is a image whereas some of the email marketing companies do it in the same way and google ios not able to read it and hence image is displayed irrespective of the fact that whether user opts show images or not
Oct 24 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.