Imageresizer::_copyAndResize PHP Method

_copyAndResize() public method

ファイルをコピーし、リサイズする
public _copyAndResize ( $srcImage, $newImage, $srcWidth, $srcHeight, $newWidth, $newHeight, $trimming = false ) : Image
return Image 新しいイメージオブジェクト
    function _copyAndResize($srcImage, $newImage, $srcWidth, $srcHeight, $newWidth, $newHeight, $trimming = false)
    {
        if ($trimming) {
            if ($srcWidth > $srcHeight) {
                $x = ($srcWidth - $srcHeight) / 2;
                $y = 0;
                $srcWidth = $srcHeight;
            } elseif ($srcWidth < $srcHeight) {
                $x = 0;
                $y = ($srcHeight - $srcWidth) / 2;
                $srcHeight = $srcWidth;
            } else {
                $x = 0;
                $y = 0;
            }
        } else {
            $x = 0;
            $y = 0;
        }
        imagecopyresampled($newImage, $srcImage, 0, 0, $x, $y, $newWidth, $newHeight, $srcWidth, $srcHeight);
        return $newImage;
    }