Every time I use GD, its impossible for me to use any other scripts. For example, I wrote this 'Scribble generator' when I was bored
This will create a new PNG image, and put a ton of random scribbles in there. Now, when I try to echo something before or after that script, it gives me an error. For example:
That script will give me an error saying that the Headers cannot be modified. Help? Thanks!
Code:
<?
$image = imagecreate(500,500);
$back = imagecolorallocate($image, 0,0,0);
for ($x = 0; $x < rand(3,7); $x++ ) {
$arrayx = array();
$points = rand(100, 300);
for ($i = 0; $i < $points; $i++) {
$arrayx[] = rand(0, 500);
$arrayx[] = rand(0, 500);
}
$color = imagecolorallocate($image, rand(0,255) ,rand(0,255),rand(0,255));
imagepolygon($image, $arrayx, $points, $color);
}
Header("Content-type: image/png");
imagepng($image);
?>
This will create a new PNG image, and put a ton of random scribbles in there. Now, when I try to echo something before or after that script, it gives me an error. For example:
Code:
<?
echo "sa";
$image = imagecreate(500,500);
$back = imagecolorallocate($image, 0,0,0);
Header("Content-type: image/png");
imagepng($image);
?>
That script will give me an error saying that the Headers cannot be modified. Help? Thanks!