How to give a php link to image source (<img src=)

Post Reply
User avatar
Saman
Lieutenant Colonel
Lieutenant Colonel
Posts: 828
Joined: Fri Jul 31, 2009 10:32 pm
Location: Mount Lavinia

How to give a php link to image source (<img src=)

Post by Saman » Thu Nov 11, 2010 5:23 pm

First we need to make the php page. Name it as test.php.

Code: Select all

<?PHP
$image = imagecreatefromstring(file_get_contents("http://yoururl.com/img.jpg"));
header('Content-Type: image/png');
imagepng($image);
imagedestroy($image);
?>
now we can provide the php page as img source as below.

Code: Select all

<html>
<body>
<img src="test.php">
</body>
</html>
 
Pansophic
Sergeant
Sergeant
Posts: 25
Joined: Sun Feb 13, 2011 4:05 pm

Re: How to give a php link to image source (<img src=)

Post by Pansophic » Tue Mar 01, 2011 2:39 pm

nice script over there, didn't knew about this.
Post Reply

Return to “PHP & MySQL”