public function thumbnail($width, $height = null)
    {
        if (!isset($height)) {
            $height = $width;
        }

        if (($height / $width) > ($this->height / $this->width)) {
            $this->fitToHeight($height);
        } else {
            $this->fitToWidth($width);
        }

        $left = floor(($this->width / 2) - ($width / 2));
        $top = floor(($this->height / 2) - ($height / 2));

        return $this->crop($left, $top, $width + $left, $height + $top);
    }
public function thumbnail($width, $height = null)
    {
        if (!isset($height)) {
            $height = $width;
        }

        if (($height / $width) > ($this->height / $this->width)) {
            $this->fitToHeight($height);
        } else {
            $this->fitToWidth($width);
        }

        $left = floor(($this->width / 2) - ($width / 2));
        $top = floor(($this->height / 2) - ($height / 2));

        return $this->crop($left, $top, $width + $left, $height + $top);
    }
public function thumbnail ( $ width , $ height = null ) { if ( ! isset ( $ height ) ) { $ height = $ width ; } if ( ( $ height / $ width ) > ( $ this -> height / $ this -> width ) ) { $ this -> fitToHeight ( $ height ) ; } else { $ this -> fitToWidth ( $ width ) ; } $ left = floor ( ( $ this -> width / 2 ) - ( $ width / 2 ) ) ; $ top = floor ( ( $ this -> height / 2 ) - ( $ height / 2 ) ) ; return $ this -> crop ( $ left , $ top , $ width + $ left , $ height + $ top ) ; }
Create image thumbnail keeping aspect ratio
@param int $width
@param int|null $height
@return $this
Create image thumbnail keeping aspect ratio