Prøv at se her:
http://www.codebreaker.dk/exp/695762.phpOg koden er her:
<?php
//http://www.eksperten.dk/spm/695762
function LoadPNG($imgname)
{
$im = @imagecreatefrompng($imgname); /* Attempt to open */
if(!$im)
{
/* See if it failed */
$im = imagecreate(20, 20); /* Create a blank image */
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefill($im, 0, 0, $bgc);
/* Output an errmsg */
imagestring($im, 1, 5, 5, "Error loading $imgname", $tc);
}
return $im;
}
header ("Content-type: image/png");
$im = @imagecreatetruecolor(500, 500) or die("Cannot Initialize new GD image stream");
$img[1] = LoadPNG("pic1.png");
$img[2] = LoadPNG("pic2.png");
$img[3] = LoadPNG("pic3.png");
$img[4] = LoadPNG("pic4.png");
$img[5] = LoadPNG("pic5.png");
$img[6] = LoadPNG("pic6.png");
for($i = 1; $i <= 6; $i++)
{
imagecopymerge ($im, $img[$i], rand(0,480), rand(0,480), 0, 0, 20, 20, 100);
}
imagepng($im);
imagedestroy($im);
?>
Koordinaterne styres via rand(0,480)