Resize an image

@param $width
@param $height
@return $this
973922
public function resize($width, $height)
    {

        $new = imagecreatetruecolor($width, $height);
        imagealphablending($new, false);
        imagesavealpha($new, true);
        imagecopyresampled($new, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height);

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

        return $this;

    }
398815
public function resize($width, $height) {
        if ($width && $height) $this->thumb->resize($width, $height);
        else if (!$width) $this->thumb->resize(99999, $height);
        else if (!$height) $this->thumb->resize($width, 99999);
        return $this;
    }
1094941
protected function thumbnailResize(Image $image, $width, $height)
    {
        return $image->resize($width, $height, function ($constraint) {
            $constraint->aspectRatio();
        });
    }
980935
public function resize_max( $width, $height ) 
	{
		$new_width = $this->width;
		$new_height = $this->height;

		if ( $new_width > $width ) 
		{
			// set new with
			$new_width = $width;
			// calculate height
			$new_height = $new_width * ( $this->height / $this->width );
		}

		if ( $new_height > $height ) 
		{
			// set new height
			$new_height = $height;
			// calculate width
			$new_width = $new_height * ( $this->width / $this->height );
		}

		return $this->resize_strict( $new_width, $new_height );
	}
1036102
public function resize($width, $height)
    {
        $this->mode = 'resize';
        $this->targetSize = [$width, $height];
        $this->arguments = [];

        return $this->process();
    }
501575
public function resize(int $width = 0, int $height = 0)
    {
        $this->instance->scaleImage($width, $height);
    }
965152
public function resizeToWidth($width)
    {
        $height = $this->getPropHeight($width);
        $this->resize($width, $height);

        return $this;
    }
754394
public function resize_fit( $width, $height, $background_color = '#fff' ) 
	{
		$background = static::blank( $width, $height );

		// make out actual image max size
		static::resize_max( $width, $height );

		// make background white
		$background->fill_color( $background_color );

		// add the layer
		$background->add_layer( $this, 'center', 'middle' );

		// overwrite the image context 
		$this->image_context = $background->image_context;

		// update properties
		$this->width = $width; 
		$this->height = $height;

		// return self
		return $this;
	}
1216151
public function resize($width, $height)
    {
        $width = (int)$width;
        $height = (int)$height;
        $tmpImage = imagecreatetruecolor($width, $height);
        imagefilledrectangle($tmpImage, 0, 0, $width, $height, $this->backgroundColor);
        imagecopyresampled($tmpImage, $this->resource, 0, 0, 0, 0, $width, $height, $this->width, $this->height);
        $this->width = $width;
        $this->height = $height;
        $this->resource = $tmpImage;
    }
936540
public function resize(int $width = 0, int $height = 0)
    {
        if (!$width && !$height) {
            throw new ImageException('You must supply at least one dimension');
        }
        $iw = $this->info[0];
        $ih = $this->info[1];
        if (!$height || !$width) {
            if (!$width) {
                $width  = $height / $ih * $iw;
            }
            if (!$height) {
                $height = $width  / $iw * $ih;
            }
        }
        $di = imagecreatetruecolor($width, $height);
        imagecopyresized($di, $this->data, 0, 0, 0, 0, $width, $height, $iw, $ih);
        $this->data = $di;
    }
507478
public function do_resize($width, $height)
    {
        if (version_compare(PHP_VERSION, '5.5.0') < 0) {
            $image = imagecreatetruecolor($width, $height);
            imagealphablending($image, false);
            imagesavealpha($image, true);

            imagecopyresampled($image, $this->_image, 0, 0, 0, 0, $width, $height, $this->_width, $this->_height);
        } else {
            $image = imagescale($this->_image, $width, $height);
        }

        imagedestroy($this->_image);
        $this->_image = $image;
        $this->_width = imagesx($image);
        $this->_height = imagesy($image);

        return $this;
    }
313005
public function resize($width = null, $height = null)
    {
        $this->styleAttributes['width'] = $width . 'px';
        $this->styleAttributes['height'] = $height . 'px';

        return $this;
    }
508613
public function resize_fill( $width, $height ) 
	{
		$original_aspect = $this->width / $this->height;
		$thumb_aspect = $width / $height;

		if ( $original_aspect >= $thumb_aspect )
		{
		   $new_height = $height;
		   $new_width = $this->width / ($this->height / $height);
		}
		else
		{
		   $new_width = $width;
		   $new_height = $this->height / ($this->width / $width);
		}

		$x = 0 - ( $new_width - $width ) / 2;
		$y = 0 - ( $new_height - $height ) / 2;

		$result = imagecreatetruecolor( $width, $height );
		imagecopyresampled( $result, $this->image_context, $x, $y, 0, 0, $new_width, $new_height, $this->width, $this->height );

		// overwrite the image context 
		$this->image_context = $result;

		// update properties
		$this->reload_context_info();

		// return self
		return $this;
	}
1319234
public function paperSize($width,$height)
    {
        $this->paperWidth = $width;
        $this->paperHeight = $height;
        return $this;
    }
919512
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;
    }
221549
protected function resizeExact($file, $width, $height)
	{
		return $this->imagine
			->open($file->getRealPath())
			->resize(new Box($width, $height));
	}
550615
public function cropAndResizeFromCenter($width, $height)
        {
            $this->resizeOut($width, $height);
            $this->cropFromCenter($width, $height);

            return $this;
        }