/** * create result image from given temporary image * * @param resource $image * @param int $leftUpX x-coordinate of the left up corner of the new image * @param int $leftUpY y-coordinate of the left up corner of the new image * @param int $width width of the new image * @param int $height of the new image * @return resource */ protected function _createResultMapImage($image, $leftUpX, $leftUpY, $width, $height) { if ($leftUpY < 0) { $height += $leftUpY; $leftUpY = 0; } $imageWidth = imagesx($image); $imageHeight = imagesy($image); if ($leftUpY + $height > $imageHeight) { $height = $imageHeight - $leftUpY; } $newImage = $this->_tileSource->getImageHandler()->createImage($width, $height); imagecopy($newImage, $image, 0, 0, $leftUpX, $leftUpY, $width, $height); return $newImage; }