Neos.Media/Classes/Domain/Model/Adjustment/ResizeImageAdjustment.php
protected function calculateDimensions(BoxInterface $originalDimensions)
    {
        $newDimensions = clone $originalDimensions;

        switch (true) {
            // height and width are set explicitly:
            case ($this->width !== null && $this->height !== null):
                $newDimensions = $this->calculateWithFixedDimensions($originalDimensions, $this->width, $this->height);
                break;
            // only width is set explicitly:
            case ($this->width !== null):
                $newDimensions = $this->calculateScalingToWidth($originalDimensions, $this->width);
                break;
            // only height is set explicitly:
            case ($this->height !== null):
                $newDimensions = $this->calculateScalingToHeight($originalDimensions, $this->height);
                break;
        }

        // We apply maximum dimensions and scale the new dimensions proportionally down to fit into the maximum.
        if ($this->maximumWidth !== null && $newDimensions->getWidth() > $this->maximumWidth) {
            $newDimensions = $newDimensions->widen($this->maximumWidth);
        }

        if ($this->maximumHeight !== null && $newDimensions->getHeight() > $this->maximumHeight) {
            $newDimensions = $newDimensions->heighten($this->maximumHeight);
        }

        return $newDimensions;
    }
protected function calculateDimensions(BoxInterface $originalDimensions)
    {
        $newDimensions = clone $originalDimensions;

        switch (true) {
            // height and width are set explicitly:
            case ($this->width !== null && $this->height !== null):
                $newDimensions = $this->calculateWithFixedDimensions($originalDimensions, $this->width, $this->height);
                break;
            // only width is set explicitly:
            case ($this->width !== null):
                $newDimensions = $this->calculateScalingToWidth($originalDimensions, $this->width);
                break;
            // only height is set explicitly:
            case ($this->height !== null):
                $newDimensions = $this->calculateScalingToHeight($originalDimensions, $this->height);
                break;
        }

        // We apply maximum dimensions and scale the new dimensions proportionally down to fit into the maximum.
        if ($this->maximumWidth !== null && $newDimensions->getWidth() > $this->maximumWidth) {
            $newDimensions = $newDimensions->widen($this->maximumWidth);
        }

        if ($this->maximumHeight !== null && $newDimensions->getHeight() > $this->maximumHeight) {
            $newDimensions = $newDimensions->heighten($this->maximumHeight);
        }

        return $newDimensions;
    }
protected function calculateDimensions ( BoxInterface $ originalDimensions ) { $ newDimensions = clone $ originalDimensions ; switch ( true ) { // height and width are set explicitly: case ( $ this -> width !== null && $ this -> height !== null ) : $ newDimensions = $ this -> calculateWithFixedDimensions ( $ originalDimensions , $ this -> width , $ this -> height ) ; break ; // only width is set explicitly: case ( $ this -> width !== null ) : $ newDimensions = $ this -> calculateScalingToWidth ( $ originalDimensions , $ this -> width ) ; break ; // only height is set explicitly: case ( $ this -> height !== null ) : $ newDimensions = $ this -> calculateScalingToHeight ( $ originalDimensions , $ this -> height ) ; break ; } // We apply maximum dimensions and scale the new dimensions proportionally down to fit into the maximum. if ( $ this -> maximumWidth !== null && $ newDimensions -> getWidth ( ) > $ this -> maximumWidth ) { $ newDimensions = $ newDimensions -> widen ( $ this -> maximumWidth ) ; } if ( $ this -> maximumHeight !== null && $ newDimensions -> getHeight ( ) > $ this -> maximumHeight ) { $ newDimensions = $ newDimensions -> heighten ( $ this -> maximumHeight ) ; } return $ newDimensions ; }
Calculates and returns the dimensions the image should have according all parameters set
in this adjustment.

@param BoxInterface $originalDimensions Dimensions of the unadjusted image
@return BoxInterface
Calculates and returns the dimensions the image should have according all parameters set in this adjustment .