I want to generate an image using the following code, and think it should have worked.
Unfortunately I get an error message saying the header info has already been sent,
and the browser (IE5) doesn't print a picture just the
characterset representing the picture. I think I've got it right, but obviously, I
don't. Any help will be greatly appreciated.
1.
2.
3. <?php
4. print "jpeg format<br>";
5. header("content-type: image/jpeg",replace);
6. $image=imagecreate(200,200);
7. $red=imagecolorallocate($image,255,0,0);
8. $blue=imagecolorallocate($image,0,0,255);
9. imagearc($image,99,99,180,180,0,360,$blue);
10. imagefill($image,99,99,$blue);
11. imagejpeg($image);
?>
<html>
<body>
<img src="test.php" alt="a php generated image">
</body>
</html>
what I get is the following:
Warning: Cannot add header information - headers already sent by (output started at
/www/ironorchid/stocks/test.php:3) in /www/ironorchid/stocks/test.php on line 5
ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), ...
A printout of the jpeg file (I think) and a broken link icon.