public function resize($x, $y, $proportional = true)
    {
        // Check firstly values
        if ($x === null || $x > $this->width) {
            $x = $this->width;
        }

        if ($y === null || $y > $this->height) {
            $y = $this->height;
        }

        if ($proportional === true) {
            $height = $y;
            $width = round($height / $this->height * $this->width);

            if ($width < $x) {
                $width = $x;
                $height = round($width / $this->width * $this->height);
            }

        } else {
            // When no proportionality required, then use target dimensions
            $width = $x;
            $height = $y;
        }

        // Done calculating. Create a new image in memory
        $image = imagecreatetruecolor($width, $height);

        $this->preserveTransparency($image);

        imagecopyresampled($image, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height);

        $this->setImage($image);

        $this->width = $width;
        $this->height = $height;

        return $this;
    }
public function resize($x, $y, $proportional = true)
    {
        // Check firstly values
        if ($x === null || $x > $this->width) {
            $x = $this->width;
        }

        if ($y === null || $y > $this->height) {
            $y = $this->height;
        }

        if ($proportional === true) {
            $height = $y;
            $width = round($height / $this->height * $this->width);

            if ($width < $x) {
                $width = $x;
                $height = round($width / $this->width * $this->height);
            }

        } else {
            // When no proportionality required, then use target dimensions
            $width = $x;
            $height = $y;
        }

        // Done calculating. Create a new image in memory
        $image = imagecreatetruecolor($width, $height);

        $this->preserveTransparency($image);

        imagecopyresampled($image, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height);

        $this->setImage($image);

        $this->width = $width;
        $this->height = $height;

        return $this;
    }
public function resize ( $ x , $ y , $ proportional = true ) { // Check firstly values if ( $ x === null || $ x > $ this -> width ) { $ x = $ this -> width ; } if ( $ y === null || $ y > $ this -> height ) { $ y = $ this -> height ; } if ( $ proportional === true ) { $ height = $ y ; $ width = round ( $ height / $ this -> height * $ this -> width ) ; if ( $ width < $ x ) { $ width = $ x ; $ height = round ( $ width / $ this -> width * $ this -> height ) ; } } else { // When no proportionality required, then use target dimensions $ width = $ x ; $ height = $ y ; } // Done calculating. Create a new image in memory $ image = imagecreatetruecolor ( $ width , $ height ) ; $ this -> preserveTransparency ( $ image ) ; imagecopyresampled ( $ image , $ this -> image , 0 , 0 , 0 , 0 , $ width , $ height , $ this -> width , $ this -> height ) ; $ this -> setImage ( $ image ) ; $ this -> width = $ width ; $ this -> height = $ height ; return $ this ; }
Resizes the image

@param integer $x New width
@param integer $y New height
@param boolean $proportional Whether to resize proportionally
@return \Krystal\Image\Processor\GD\ImageProcessor
Resizes the image