Hi,
I have a problem with conditional image generation. If I generate an
image without any conditional statments, then everything works fine. But
if i introduce conditional statment, then no image is generated in
either case of the condition.
Has anyone dealt with this dilema before?
Thanks in advance,
alex
P.S.
I am generating a hit-counter image.
The set-up is very basic:
if admin looks at the page, then image should be generated and displayed
if anyone else loads the page, no image should be generated.
my code goes smth like this:
<?php
if (! fromOffice() ) {
$image = ImageCreate(1,1);
$navyblue = ImageColorAllocate($image, 0, 0, 0);
ImageFilledRectangle($image, 0, 0, 1, 1, $navyblue);
} else {
$image = ImageCreate(125, 150);
//...
}
header("Content-Type: image/png");
header("Content-Disposition: inline; filename=counter.php");
ImagePng($image);
//have to destroy the image, otherwise will starve web-server's memory
ImageDestroy($image);
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php