library/Garp/Image/Scaler.php
private function _getProjectionSize() {
        $sourceWidth = $this->_params['sourceWidth'];
        $sourceHeight = $this->_params['sourceHeight'];
        $sourceRatio = $sourceWidth / $sourceHeight;

        $canvasWidth = $this->_params['w'];
        $canvasHeight = $this->_params['h'];
        $canvasRatio = $canvasWidth / $canvasHeight;


        //  the image is not allowed to be cut off in any dimension
        if ($sourceRatio < $canvasRatio) {
            //  source is less landscape-like than canvas
            $leadDimension = !$this->_params['crop'] ?
                'Height' : 'Width';
        } else {
            //  source is more landscape-like than canvas
            $leadDimension = !$this->_params['crop'] ?
                'Width' : 'Height';
        }

        if (!$this->_params['grow']
            && ${'source' . $leadDimension} < ${'canvas' . $leadDimension}
        ) {
            ${'projection' . $leadDimension} = ${'source' . $leadDimension};
        } else {
            ${'projection' . $leadDimension} = ${'canvas' . $leadDimension};
        }

        if (isset($projectionWidth)) {
            $projectionHeight = $projectionWidth / $sourceRatio;
        } elseif (isset($projectionHeight)) {
            $projectionWidth = $projectionHeight * $sourceRatio;
        }

        return array(round($projectionWidth), round($projectionHeight));
    }
private function _getProjectionSize() {
        $sourceWidth = $this->_params['sourceWidth'];
        $sourceHeight = $this->_params['sourceHeight'];
        $sourceRatio = $sourceWidth / $sourceHeight;

        $canvasWidth = $this->_params['w'];
        $canvasHeight = $this->_params['h'];
        $canvasRatio = $canvasWidth / $canvasHeight;


        //  the image is not allowed to be cut off in any dimension
        if ($sourceRatio < $canvasRatio) {
            //  source is less landscape-like than canvas
            $leadDimension = !$this->_params['crop'] ?
                'Height' : 'Width';
        } else {
            //  source is more landscape-like than canvas
            $leadDimension = !$this->_params['crop'] ?
                'Width' : 'Height';
        }

        if (!$this->_params['grow']
            && ${'source' . $leadDimension} < ${'canvas' . $leadDimension}
        ) {
            ${'projection' . $leadDimension} = ${'source' . $leadDimension};
        } else {
            ${'projection' . $leadDimension} = ${'canvas' . $leadDimension};
        }

        if (isset($projectionWidth)) {
            $projectionHeight = $projectionWidth / $sourceRatio;
        } elseif (isset($projectionHeight)) {
            $projectionWidth = $projectionHeight * $sourceRatio;
        }

        return array(round($projectionWidth), round($projectionHeight));
    }
private function _getProjectionSize ( ) { $ sourceWidth = $ this -> _params [ 'sourceWidth' ] ; $ sourceHeight = $ this -> _params [ 'sourceHeight' ] ; $ sourceRatio = $ sourceWidth / $ sourceHeight ; $ canvasWidth = $ this -> _params [ 'w' ] ; $ canvasHeight = $ this -> _params [ 'h' ] ; $ canvasRatio = $ canvasWidth / $ canvasHeight ; //  the image is not allowed to be cut off in any dimension if ( $ sourceRatio < $ canvasRatio ) { //  source is less landscape-like than canvas $ leadDimension = ! $ this -> _params [ 'crop' ] ? 'Height' : 'Width' ; } else { //  source is more landscape-like than canvas $ leadDimension = ! $ this -> _params [ 'crop' ] ? 'Width' : 'Height' ; } if ( ! $ this -> _params [ 'grow' ] && $ { 'source' . $ leadDimension } < $ { 'canvas' . $ leadDimension } ) { $ { 'projection' . $ leadDimension } = $ { 'source' . $ leadDimension } ; } else { $ { 'projection' . $ leadDimension } = $ { 'canvas' . $ leadDimension } ; } if ( isset ( $ projectionWidth ) ) { $ projectionHeight = $ projectionWidth / $ sourceRatio ; } elseif ( isset ( $ projectionHeight ) ) { $ projectionWidth = $ projectionHeight * $ sourceRatio ; } return array ( round ( $ projectionWidth ) , round ( $ projectionHeight ) ) ; }
Calculate projection size of source image on canvas.
The resulting projection might be larger than the canvas; this function does
not consider cutoff by means of cropping.

@return array Numeric array containing projection width and height in pixels.
Calculate projection size of source image on canvas . The resulting projection might be larger than the canvas ; this function does not consider cutoff by means of cropping .