[$sx, $sy]) { // ($sx, $sy): the middle of the platform on the ground; the tower stands over it imagecopyresampled($out, $frame, $i * 100, 0, (int)$sx - 50, (int)$sy - 106, 100, 140, 100, 140); } save($out, "$cards/side-$side.png"); }