public function resize(&$image, $newWidth, $newHeight, $mode = 'fit')
    {
        /*
         * Resize formula:
         * ratio = w / h
         * h = w / ratio
         * w = h * ratio
         */
        switch ($mode) {
            case 'exact':
                $this->resizeExact($image, $newWidth, $newHeight);
                break;
            case 'fill':
                $this->resizeFill($image, $newWidth, $newHeight);
                break;
            case 'exactWidth':
                $this->resizeExactWidth($image, $newWidth);
                break;
            case 'exactHeight':
                $this->resizeExactHeight($image, $newHeight);
                break;
            case 'fit':
                $this->resizeFit($image, $newWidth, $newHeight);
                break;
            default:
                throw new \Exception(sprintf('Invalid resize mode "%s".', $mode));
        }

        return $this;
    }
public function resize(&$image, $newWidth, $newHeight, $mode = 'fit')
    {
        /*
         * Resize formula:
         * ratio = w / h
         * h = w / ratio
         * w = h * ratio
         */
        switch ($mode) {
            case 'exact':
                $this->resizeExact($image, $newWidth, $newHeight);
                break;
            case 'fill':
                $this->resizeFill($image, $newWidth, $newHeight);
                break;
            case 'exactWidth':
                $this->resizeExactWidth($image, $newWidth);
                break;
            case 'exactHeight':
                $this->resizeExactHeight($image, $newHeight);
                break;
            case 'fit':
                $this->resizeFit($image, $newWidth, $newHeight);
                break;
            default:
                throw new \Exception(sprintf('Invalid resize mode "%s".', $mode));
        }

        return $this;
    }
public function resize ( & $ image , $ newWidth , $ newHeight , $ mode = 'fit' ) { /*
         * Resize formula:
         * ratio = w / h
         * h = w / ratio
         * w = h * ratio
         */ switch ( $ mode ) { case 'exact' : $ this -> resizeExact ( $ image , $ newWidth , $ newHeight ) ; break ; case 'fill' : $ this -> resizeFill ( $ image , $ newWidth , $ newHeight ) ; break ; case 'exactWidth' : $ this -> resizeExactWidth ( $ image , $ newWidth ) ; break ; case 'exactHeight' : $ this -> resizeExactHeight ( $ image , $ newHeight ) ; break ; case 'fit' : $ this -> resizeFit ( $ image , $ newWidth , $ newHeight ) ; break ; default : throw new \ Exception ( sprintf ( 'Invalid resize mode "%s".' , $ mode ) ) ; } return $ this ; }
Wrapper function for the resizeXXX family of functions. Resize image given width, height and mode.

@param Image $image
@param int $newWidth Width in pixels.
@param int $newHeight Height in pixels.
@param string $mode Resize mode. Possible values: "exact", "exactHeight", "exactWidth", "fill", "fit".

@return Editor
@throws \Exception
Wrapper function for the resizeXXX family of functions . Resize image given width height and mode .