Neos.Media/Classes/Domain/Model/Adjustment/ResizeImageAdjustment.php
protected function calculateOutboundBox(BoxInterface $originalDimensions, $requestedWidth, $requestedHeight)
    {
        $newDimensions = new Box($requestedWidth, $requestedHeight);

        if ($this->getAllowUpScaling() === true || $originalDimensions->contains($newDimensions) === true) {
            return $newDimensions;
        }

        // We need to make sure that the new dimensions are such that no upscaling is needed.
        $ratios = [
            $originalDimensions->getWidth() / $requestedWidth,
            $originalDimensions->getHeight() / $requestedHeight
        ];

        $ratio = min($ratios);
        $newDimensions = $newDimensions->scale($ratio);

        return $newDimensions;
    }
protected function calculateOutboundBox(BoxInterface $originalDimensions, $requestedWidth, $requestedHeight)
    {
        $newDimensions = new Box($requestedWidth, $requestedHeight);

        if ($this->getAllowUpScaling() === true || $originalDimensions->contains($newDimensions) === true) {
            return $newDimensions;
        }

        // We need to make sure that the new dimensions are such that no upscaling is needed.
        $ratios = [
            $originalDimensions->getWidth() / $requestedWidth,
            $originalDimensions->getHeight() / $requestedHeight
        ];

        $ratio = min($ratios);
        $newDimensions = $newDimensions->scale($ratio);

        return $newDimensions;
    }
protected function calculateOutboundBox ( BoxInterface $ originalDimensions , $ requestedWidth , $ requestedHeight ) { $ newDimensions = new Box ( $ requestedWidth , $ requestedHeight ) ; if ( $ this -> getAllowUpScaling ( ) === true || $ originalDimensions -> contains ( $ newDimensions ) === true ) { return $ newDimensions ; } // We need to make sure that the new dimensions are such that no upscaling is needed. $ ratios = [ $ originalDimensions -> getWidth ( ) / $ requestedWidth , $ originalDimensions -> getHeight ( ) / $ requestedHeight ] ; $ ratio = min ( $ ratios ) ; $ newDimensions = $ newDimensions -> scale ( $ ratio ) ; return $ newDimensions ; }
Calculate the final dimensions for an outbound box. usually exactly the requested width and height unless that
would require upscaling and it is not allowed.

@param BoxInterface $originalDimensions
@param integer $requestedWidth
@param integer $requestedHeight
@return BoxInterface
Calculate the final dimensions for an outbound box . usually exactly the requested width and height unless that would require upscaling and it is not allowed .