RE: [PHP] Image output (Newb question)
| From: | Matt Matijevich | Date: | Fri, 02 Apr 2004 22:09:33 +0000 |
| Subject: | RE: [PHP] Image output (Newb question) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-182205@lists.php.net to get a copy of this message | ||
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"
/>