I have this image function that I have a litte problem with
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);
}
How can place each image in the foreach 100 pixels from the previous one?
next image in the loop:
imagecopy($img, $cur, previous_x_coord+100, 0, 0, 0, 125, 32);
Just store a variable which starts at zero and adds 100 at the end of every loop iteration: