Hi there, this might be a new question (or maybe not). I am trying to work with the GD library to make some usage graphs. I just thought I would experiment a bit with some of the functions and things, and I got stumped.
Here is the code I have culled from several sources -- it is suppose to color a box:
<?php
header("Content-type: image/jpeg");
$image = imagecreate(200,200);
$maroon = ImageColorAllocate($image,100,0,0);
$white = ImageColorAllocate($image,255,255,255);
ImageFilledRectangle($image,0,0,200,200,$white);
ImageRectangle($image,10,10,190,190,$maroon);
ImageFilledRectangle($image,50,50,150,150,$maroon
);
ImageJPEG($image);
ImageDestroy($image);
?>
Now, I understand that the only way to get this to work is to send the browser the header() form; this will then get the browser to render images properly.
My problem is that, despite the header appearing before any actual html, it still only renders ascii characters, like this:
ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛC $.' ",#(7),01444'9=82<.342ÿÛC 2!!222222222222222222222222222222222222222222222
22222ÿÀÈÈ"ÿÄ ÿĵ}!
Any idea why this might be happening? Hopefully, somebody will have jumped this rail before.
Thanks
Ego