Resizes the given image using the specified dimensions and resize method.

@param Image $image
@param integer $width
@param integer $height
@param string $method

@return Image
167735
public function resize(Image $image, $width, $height, $method)
    {
        // Get Image Dimensions:
        
        $imageWidth  = $image->getWidth();
        $imageHeight = $image->getHeight();
        
        // Calculate Width and Height (if required):
        
        if ($width && !$height && $imageWidth) {
            $height = round(($width / $imageWidth) * $imageHeight);
        } elseif (!$width && $height && $imageHeight) {
            $width = round(($height / $imageHeight) * $imageWidth);
        }
        
        // Perform Image Resizing:
        
        if ($width && $height) {
            
            switch (strtolower($method)) {
                
                case self::RESIZE_CROP_WIDTH:
                    return $image->CropWidth($width);
                    
                case self::RESIZE_CROP_HEIGHT:
                    return $image->CropHeight($height);
                    
                case self::RESIZE_FILL:
                    return $image->Fill($width, $height);
                    
                case self::RESIZE_FILL_MAX:
                    return $image->FillMax($width, $height);
                    
                case self::RESIZE_FILL_PRIORITY:
                    return $image->FillPriority($width, $height);
                    
                case self::RESIZE_FIT:
                    return $image->Fit($width, $height);
                    
                case self::RESIZE_FIT_MAX:
                    return $image->FitMax($width, $height);
                    
                case self::RESIZE_PAD:
                    return $image->Pad($width, $height);
                    
                case self::RESIZE_SCALE_WIDTH:
                    return $image->ScaleWidth($width);
                    
                case self::RESIZE_SCALE_HEIGHT:
                    return $image->ScaleHeight($height);
                    
                case self::RESIZE_SCALE_MAX_WIDTH:
                    return $image->ScaleMaxWidth($width);
                    
                case self::RESIZE_SCALE_MAX_HEIGHT:
                    return $image->ScaleMaxHeight($height);
                    
            }
            
        }
        
        // Answer Original Image:
        
        return $image;
    }
283717
protected function resizePortrait(ImageInterface $image, $width, $height, $enlarge = true)
    {
        // Don't enlarge a small image
        $box = $image->getSize();
        $ratio = $box->getWidth() / $box->getHeight();

        if ($enlarge === false && $box->getHeight() < $height) {
            $height = $box->getHeight();
        }

        $dimensions = $image->getSize()
            ->heighten($height)
            ->widen($height * $ratio);

        return $image->resize($dimensions);
    }
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;
    }
825914
public function getImageResized($width = null, $height = null, $method = null)
    {
        if ($this->hasImage()) {
            
            $image = $this->getSlideImage();
            
            if ($width || $height || $method) {
                return ImageTools::singleton()->resize($image, $width, $height, $method);
            }
            
            if ($this->getParent()->hasMethod('performImageResize')) {
                return $this->getParent()->performImageResize($image);
            }
            
            return $image;
            
        }
    }
693954
public function resize($width, $height) {
		$image = imagecreatetruecolor($width, $height);
		imagecopyresampled($image, $this->_image, 0, 0, 0, 0, $width, $height, $this->width, $this->height);
		imagedestroy($this->_image);
		$this->_image = $image;
		return $this;
	}
1051075
public function resize($width, $height)
    {
        $newImage = imagecreatetruecolor($width, $height);

        $this->strategy->handleTransparency($newImage, $this->image);

        // Now resample the image
        imagecopyresampled($newImage, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());

        // And allocate to $this
        $this->image = $newImage;
    }
459052
public function resize(
        ImageInterface $image,
        $height,
        $width,
        $type = ElcodiMediaImageResizeTypes::FORCE_MEASURES
    ) {
        $imageData = $this
            ->fileManager
            ->downloadFile($image)
            ->getContent();

        if (ElcodiMediaImageResizeTypes::NO_RESIZE === $type) {
            $image->setContent($imageData);

            return $image;
        }

        $resizedImageData = $this
            ->resizeAdapter
            ->resize($imageData, $height, $width, $type);

        /**
         * We need to physically store the new resized
         * image in order to access its metadata, such as
         * file size, image dimensions, mime type etc.
         * Ideally, we should be doing this in memory.
         */
        $resizedFile = new File(tempnam(sys_get_temp_dir(), '_generated'));
        file_put_contents($resizedFile, $resizedImageData);

        $image = $this->createImage($resizedFile);
        $image->setContent($resizedImageData);

        unlink($resizedFile);

        return $image;
    }
363860
public function resize($filename, $width, $height)
    {
        // open an image file
        $img = Image::make($this->pathOfImagesUploadFolder() .'/'. $filename);

        // resize image
        // http://image.intervention.io/api/resize
        // closure prevents possible upsizing
        $img->resize($width, $height, function ($constraint) {
            $constraint->aspectRatio();
            $constraint->upsize();
        });

        $img->save($this->pathFilenameOfResizedImage($filename, $width, $height));
    }
1024711
public function resize(int $width, int $height, bool $crop = false): self
    {
        $this->image = $this->resizeImage($this->image, $width, $height, $crop);
        return $this;
    }
327559
public function runCropResize(Image $image, $width, $height)
    {
        list($resize_width, $resize_height) = $this->resolveCropResizeDimensions($image, $width, $height);

        $zoom = $this->getCrop()[2];

        $image->resize($resize_width * $zoom, $resize_height * $zoom, function ($constraint) {
            $constraint->aspectRatio();
        });

        list($offset_x, $offset_y) = $this->resolveCropOffset($image, $width, $height);

        return $image->crop($width, $height, $offset_x, $offset_y);
    }
641279
protected function resizeAuto($file, $width, $height)
	{
		// Image to be resized is wider (landscape)
		if ($height < $width) {
			return $this->resizeLandscape($file, $width, $height);

		}

		// Image to be resized is taller (portrait)
		if ($height > $width){
			return $this->resizePortrait($file, $width, $height);
		}

		// Image to be resizerd is a square
		return $this->resizeExact($file, $width, $height);
	}
185618
public function resize($image, $width = null, $height = null, $options = [])
    {
        if (!$this->fileExists($image)) {
            return $this->getMediaImageUrl($image);
        }
        
        $resizedImage = 'resized/' . $width . 'x' . $height . '/' . $image;
        if (!$this->fileExists($resizedImage)) {
            $imageResize = $this->setup($image, $width, $height, $options);
            $imageResize->resize($width, $height);
            $imageResize->save($this->getMediaDirectory()->getAbsolutePath($resizedImage));
        }
        
        return $this->getMediaImageUrl($resizedImage);
    }
1175371
public function create(int $width, int $height): self
    {
        $this->width = $width;
        $this->height = $height;
        $imageData = imagecreatetruecolor($this->width, $this->height);
        if (false === $imageData) {
            throw new ImageException('Unable to create new image!');
        }
        $this->workingData = $imageData;
        if (self::FORMAT_PNG === $this->extension) {
            $this->setTransparency(false, true);
        }
        if (self::FORMAT_GIF === $this->extension) {
            $this->setTransparency();
        }
        $this->encrypted = false;
        return $this;
    }
669101
public function manipulate(AbstractImage $image, $width, $height)
    {
        $box = $this->calculateResize($image, $width, $height);

        return $image->resize($box);
    }
292826
protected function resizePortrait($file, $width, $height)
	{
		$image = $this->imagine
			->open($file->getRealPath());

		$dimensions = $image->getSize()
			->heighten($height);

		$image = $image->resize($dimensions);

		return $image;
	}
534867
protected function resizeCrop(ImageInterface $image, $width, $height, $enlarge = true)
    {
        $size = $image->getSize();

        if ($enlarge === false && $size->getWidth() < $width) {
            $width = $size->getWidth();
        }

        if ($enlarge === false && $size->getHeight() < $height) {
            $height = $size->getHeight();
        }

        list($optimal_width, $optimal_height) = $this->getOptimalCrop($size, $width, $height, $enlarge);

        // Find center - this will be used for the crop
        $center_x = ($optimal_width / 2) - ($width / 2);
        $center_y = ($optimal_height / 2) - ($height / 2);

        return $image->resize(new Box($optimal_width, $optimal_height))
            ->crop(new Point($center_x, $center_y), new Box($width, $height));
    }
1259495
private function actionResize($width, $height)
    {
        $image = $this->getPhpThumb();
        $image->resize($width, $height);
    }