Image created with GD does not appear
| From: | Cranky | Date: | Mon, 27 Oct 2003 10:30:42 +0000 |
| Subject: | Image created with GD does not appear | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-167698@lists.php.net to get a copy of this message | ||
Hello,
I generate an image with GD in the file generate_image.php
<?php
// generate_image.php
require('config.php')
require('functions.php');
require('secure.php');
header('Content-Type: image/png');
$im = imagecreate(15, 15);
// generation of the image
// ...
imagepng($im);
imagedestroy($im);
?>
But when I call this page in an image tag like this :
<img src="generate_image.php" border="0">
The image is not found (I have the small red cross).
If I drop the 3 lines (require) at the beginning of the page then it works fine. The image is well displayed.
So I tought it was a problem with the headers, but I have verified, the 3 included files doesn't send any header.
That's very strange because if I have the 3 includes files in the code and then I go direct to the location of the file generate_file.php (and so I don't call it with a tag), then the image is well displayed.
Did you have an idea why the imaeg is not displayed when I call it with an img tag ?
Thanks a lot