Neos\Media\Domain\Model\Adjustment\CropImageAdjustment::refit PHP Метод

refit() публичный Метод

Refits the crop proportions to be the maximum size within the image boundaries.
public refit ( Neos\Media\Domain\Model\ImageInterface $image ) : void
$image Neos\Media\Domain\Model\ImageInterface
Результат void
    public function refit(ImageInterface $image)
    {
        $this->x = 0;
        $this->y = 0;
        $ratio = $this->getWidth() / $image->getWidth();
        $this->setWidth($image->getWidth());
        $this->setHeight($this->getHeight() / $ratio);
        if ($this->getHeight() > $image->getHeight()) {
            $ratio = $this->getHeight() / $image->getHeight();
            $this->setWidth($this->getWidth() / $ratio);
            $this->setHeight($image->getHeight());
        }
    }