while loop?
Posted: Sat May 27, 2006 9:06 pm
I have a 300x300 image, and have an image which is 30x30, I want it to be overlayed all over the background image, thats 10 by 10 images which would take 100 imagecopymerge things so I decided a while loop would be best and I dont know why this isnt working... this just displays a 30x30 brown square.
Code: Select all
<?PHP
$bg = imagecreatefromgif("background.gif");
$h1 = 0;
$h2 = 0;
while ($h1 <= 270) {
$i = imagecreatefromgif("rock.gif");
imagecopymerge($bg, $i, 0, 0, $h1, $h2, 30, 30, 100);
$h2 += 30;
if($h2==300) {
$h2 = 0;
$h1 += 30;
}
}
header("Content-type: image/gif");
imagegif($bg);
imagedestroy($bg);
?>