Craft\ImagerService::_enforceMaxSize PHP Method

_enforceMaxSize() private method

Enforces a max size if allowUpscale is false
private _enforceMaxSize ( $width, $height, $originalSize, $maintainAspect, $zoomFactor = 1 ) : array
$width
$height
$originalSize
return array
    private function _enforceMaxSize($width, $height, $originalSize, $maintainAspect, $zoomFactor = 1)
    {
        $adjustedWidth = $width;
        $adjustedHeight = $height;
        if ($adjustedWidth > $originalSize->getWidth() * $zoomFactor) {
            $adjustedWidth = floor($originalSize->getWidth() * $zoomFactor);
            if ($maintainAspect) {
                $adjustedHeight = floor($height * ($adjustedWidth / $width));
            }
        }
        if ($adjustedHeight > $originalSize->getHeight() * $zoomFactor) {
            $adjustedHeight = floor($originalSize->getHeight() * $zoomFactor);
            if ($maintainAspect) {
                $adjustedWidth = floor($width * ($adjustedHeight / $height));
            }
        }
        return array($adjustedWidth, $adjustedHeight);
    }