public function resizeCropCenter($width, $height)
    {
        $_width = $this->do_getWidth();
        $_height = $this->do_getHeight();

        if ($_width / $_height > $width / $height) {
            $crop_height = $_height;
            $crop_width = $width * $crop_height / $height;
            $offsetX = ($_width - $crop_width) / 2;
            $offsetY = 0;
        } else {
            $crop_width = $_width;
            $crop_height = $height * $crop_width / $width;
            $offsetY = ($_height - $crop_height) / 2;
            $offsetX = 0;
        }

        $this->crop($crop_width, $crop_height, $offsetX, $offsetY);
        $this->scale($width / $crop_width);

        return $this;
    }
public function resizeCropCenter($width, $height)
    {
        $_width = $this->do_getWidth();
        $_height = $this->do_getHeight();

        if ($_width / $_height > $width / $height) {
            $crop_height = $_height;
            $crop_width = $width * $crop_height / $height;
            $offsetX = ($_width - $crop_width) / 2;
            $offsetY = 0;
        } else {
            $crop_width = $_width;
            $crop_height = $height * $crop_width / $width;
            $offsetY = ($_height - $crop_height) / 2;
            $offsetX = 0;
        }

        $this->crop($crop_width, $crop_height, $offsetX, $offsetY);
        $this->scale($width / $crop_width);

        return $this;
    }
public function resizeCropCenter ( $ width , $ height ) { $ _width = $ this -> do_getWidth ( ) ; $ _height = $ this -> do_getHeight ( ) ; if ( $ _width / $ _height > $ width / $ height ) { $ crop_height = $ _height ; $ crop_width = $ width * $ crop_height / $ height ; $ offsetX = ( $ _width - $ crop_width ) / 2 ; $ offsetY = 0 ; } else { $ crop_width = $ _width ; $ crop_height = $ height * $ crop_width / $ width ; $ offsetY = ( $ _height - $ crop_height ) / 2 ; $ offsetX = 0 ; } $ this -> crop ( $ crop_width , $ crop_height , $ offsetX , $ offsetY ) ; $ this -> scale ( $ width / $ crop_width ) ; return $ this ; }
Resize the image by a given width and height

@param int $width
@param int $height

@return static
Resize the image by a given width and height