"The image “http://localhost/test2.php” cannot be displayed, because it contains errors."
and I get a blank page in Chrome.
- Code: Select all
<?php
header("content-type:image/png");
$im = imagecreate(100, 100);
$a = sprintf('%04x',mt_rand(0, 65535));
$b = sprintf('%04x',mt_rand(0, 65535));
$c = sprintf('%04x',mt_rand(0, 65535));
$white = imagecolorallocate($im,$a,$b,$c);
imagepng($im);
imagedestroy($im);
echo "\n\n\n$a-$b-$c";
?>
I'm using LAMP on Ubuntu 10.10. I tested the same code on a different web server and it works fine. Any idea why it would only generate the image sometimes?

