public function centerCrop($width, $height)
    {
        $pwidth = $this->getPropWidth($height);
        $pheight = $this->getPropHeight($width);

        if ($pwidth == $width && $pheight == $height) {
            $this->resizeToWidth($width);
        } else {
            if ($pheight > $height) {
                $this->resizeToWidth($width);
            } else {
                $pheight += $height - $pheight;
                $this->resizeToHeight($pheight);
            }

            $x = ($this->width - $width) / 2;
            $y = ($this->height - $height) / 2;
            $this->crop($width, $height, $x, $y);
        }

        return $this;
    }
public function centerCrop($width, $height)
    {
        $pwidth = $this->getPropWidth($height);
        $pheight = $this->getPropHeight($width);

        if ($pwidth == $width && $pheight == $height) {
            $this->resizeToWidth($width);
        } else {
            if ($pheight > $height) {
                $this->resizeToWidth($width);
            } else {
                $pheight += $height - $pheight;
                $this->resizeToHeight($pheight);
            }

            $x = ($this->width - $width) / 2;
            $y = ($this->height - $height) / 2;
            $this->crop($width, $height, $x, $y);
        }

        return $this;
    }
public function centerCrop ( $ width , $ height ) { $ pwidth = $ this -> getPropWidth ( $ height ) ; $ pheight = $ this -> getPropHeight ( $ width ) ; if ( $ pwidth == $ width && $ pheight == $ height ) { $ this -> resizeToWidth ( $ width ) ; } else { if ( $ pheight > $ height ) { $ this -> resizeToWidth ( $ width ) ; } else { $ pheight += $ height - $ pheight ; $ this -> resizeToHeight ( $ pheight ) ; } $ x = ( $ this -> width - $ width ) / 2 ; $ y = ( $ this -> height - $ height ) / 2 ; $ this -> crop ( $ width , $ height , $ x , $ y ) ; } return $ this ; }
Cuts the image proportionally and centered.

@access public
@param int $width Width crop.
@param int $height Height crop.
@return \GImage\Image
Cuts the image proportionally and centered .