Craft\ImagerService::getCropSize PHP Method

getCropSize() public method

Creates the destination crop size box
public getCropSize ( Imagine\Image\Box $originalSize, $transform ) : Imagine\Image\Box
$originalSize Imagine\Image\Box
$transform
return Imagine\Image\Box
    public function getCropSize($originalSize, $transform)
    {
        $width = $originalSize->getWidth();
        $height = $originalSize->getHeight();
        $aspect = $width / $height;
        if (isset($transform['width']) and isset($transform['height'])) {
            $width = (int) $transform['width'];
            $height = (int) $transform['height'];
        } else {
            if (isset($transform['width'])) {
                $width = (int) $transform['width'];
                $height = floor((int) $transform['width'] / $aspect);
            } else {
                if (isset($transform['height'])) {
                    $width = floor((int) $transform['height'] * $aspect);
                    $height = (int) $transform['height'];
                }
            }
        }
        // check if we want to upscale. If not, adjust the transform here
        if (!$this->getSetting('allowUpscale', $transform)) {
            list($width, $height) = $this->_enforceMaxSize($width, $height, $originalSize, true);
        }
        return new \Imagine\Image\Box($width, $height);
    }