Neos\Media\Domain\Model\Adjustment\ResizeImageAdjustment::calculateWithFixedDimensions PHP Метод

calculateWithFixedDimensions() защищенный Метод

protected calculateWithFixedDimensions ( Imagine\Image\BoxInterface $originalDimensions, integer $requestedWidth, integer $requestedHeight ) : Imagine\Image\BoxInterface
$originalDimensions Imagine\Image\BoxInterface
$requestedWidth integer
$requestedHeight integer
Результат Imagine\Image\BoxInterface
    protected function calculateWithFixedDimensions(BoxInterface $originalDimensions, $requestedWidth, $requestedHeight)
    {
        $ratioMode = $this->ratioMode ?: ImageInterface::RATIOMODE_INSET;
        if ($ratioMode === ImageInterface::RATIOMODE_OUTBOUND) {
            return $this->calculateOutboundBox($originalDimensions, $requestedWidth, $requestedHeight);
        }
        $newDimensions = clone $originalDimensions;
        $ratios = array($requestedWidth / $originalDimensions->getWidth(), $requestedHeight / $originalDimensions->getHeight());
        $ratio = min($ratios);
        $newDimensions = $newDimensions->scale($ratio);
        if ($this->getAllowUpScaling() === false && $originalDimensions->contains($newDimensions) === false) {
            return clone $originalDimensions;
        }
        return $newDimensions;
    }