我有这个图像功能,但我有一点问题
function BuildCustomBricks($myBricksAndRatios) {
$img = imagecreate(890,502);
imagealphablending($img, true);
imagesavealpha($img, true);
foreach ($this->shuffle_with_keys($myBricksAndRatios) as $key) {
$bricks_to_choose = rand(1,10);
$cur = imagecreatefrompng("/var/www/brickmixer/bricks/". $key."-".$bricks_to_choose.".png");
imagealphablending($cur, true);
imagesavealpha($cur, true);
imagecopy($img, $cur, 0, 0, 0, 0, 125, 32);
imagedestroy($cur);
}
header('Content-Type: image/png');
imagepng($img);
}
如何将每张图像放在前一张的 foreach 100 像素中?
next image in the loop:
imagecopy($img, $cur, previous_x_coord+100, 0, 0, 0, 125, 32);