RE: [PHP] Image output (Newb question)
| From: | Fidencio Monroy | Date: | Fri, 02 Apr 2004 22:15:35 +0000 |
| Subject: | RE: [PHP] Image output (Newb question) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-182206@lists.php.net to get a copy of this message | ||
This way works fine!!
Thank you very much.
-----Original Message-----
From: Matt Matijevich [mailto:matijevich@alliancetechnologies.net]
Sent: Friday, April 02, 2004 2:10 PM
To: fidencio_monroy@hotmail.com
Cc: php-general@lists.php.net
Subject: RE: [PHP] Image output (Newb question)
you should have script, call it image.php or something like that, the
only thing that should be in that script is this:
<?php
$link = mysql_connect("localhost", "root", "");
if ($link){
header("Content-type: image/png");
$im = imagecreatefrompng("images/map/map-15x9.png");
imagepng($im); //,"images/".session_id().".png"
imagedestroy($im);
mysql_close($link);
}
else{
//probably want to have another way to handle this error
echo("Not connected.");
}
?>
no html tags in there, no whitespace.
to see the image you could call the page like this
http://www.yourdomain.whatever/image.php .
you could call it in a
iumage tag like this
<img src="http://www.yourdomain.whatever/image.php"
/>