Reputation: 72
$fpos = 50;
for ($i = 21; $i >= 0; $i--)
{
if($array[$i]==1 && $arccount<4)
{
$arccount = $arccount + 1;
$path = "../sig/arc/" . $i . ".png";
$arcimg = imagecreatefrompng($path);
imagecopy($img, $arcimg, 400, 50, 0, 0, 200, $fpos);
$fpos = $fpos+50;
}
}
Instead of printing thrice, it only prints the last value it finds true, aka 1. So from the 21 pos vector where pos 1, 2 and 3 are 1 and the rest to 21 are 0, it will print only 1.png . If I change v[1] to 0, it will print v[2] and so on. Why?
arccount is nulled and the purpose is to only print the last 3 images from the end
Upvotes: 0
Views: 63
Reputation: 103
You are changing the src_h parameter with your $fpos argument. I think you probably meant to change the dest_y parameter.
Try: imagecopy($img, $arcimg, 400, $fpos, 0, 0, 200, 50);
Upvotes: 3