Resizes an image
@param String $savePath
@param String $image
@param String $newImageName
@param int $width
@param int $height
487471
public function resizeImage($savePath, $image, $newImageName, $width, $height)
    {
        
        $fileImage = $image;
        $outputImg = null;
        $ext = pathinfo($newImageName, PATHINFO_EXTENSION);

        $thumb = imagecreatetruecolor($width, $height);
        list($w, $h) = getimagesize($fileImage);

        switch(exif_imagetype($fileImage)) {
            case IMAGETYPE_GIF:
                $image = imagecreatefromgif($fileImage);
            break;
            case IMAGETYPE_JPEG:
                $image = imagecreatefromjpeg($fileImage);
            break;
            case IMAGETYPE_PNG:
                $image = imagecreatefrompng($fileImage);
            break;
        }
        
        imagecopyresampled($thumb, $image, 0, 0, 0, 0, $width, $height, $w, $h);

        switch ($ext) {
            case self::EXT_PNG:
                $outputImg = imagepng($thumb, $savePath.'/'.$newImageName, 9);
                break;
            case self::EXT_GIF:
                $outputImg = imagegif($thumb, $savePath.'/'.$newImageName);
                break;
            case self::EXT_JPG:
                $outputImg = imagejpeg($thumb, $savePath.'/'.$newImageName, 100);
                break;
        }

        imagedestroy($thumb);
    
    }
1141004
public function pathFilenameOfResizedImage($filename, $width, $height)
    {
        $path                      = $this->pathOfImagesResizedFolder();
        $filenameWithNoExtension   = $this->filenameWithNoExtension($filename);
        $filenameWithExtensionOnly = $this->filenameWithExtensionOnly($filename);

        $resizedFilename  = $path;
        $resizedFilename .= "/";
        $resizedFilename .= $filenameWithNoExtension;
        $resizedFilename .= '-';
        $resizedFilename .= $width;
        $resizedFilename .= 'x';
        $resizedFilename .= $height;
        $resizedFilename .= '.';
        $resizedFilename .= $filenameWithExtensionOnly;

        return $resizedFilename;
    }
75991
private function resize(
        $filePath,
        $phpCropMethod
    ) {
        //  Set some PHPThumb options
        $_options                = [];
        $_options['resizeUp']    = true;
        $_options['jpegQuality'] = 80;

        // --------------------------------------------------------------------------

        /**
         * Perform the resize
         * Turn errors off, if something bad happens we want to
         * output the serveBadSrc image and log the issue.
         */

        $oldErrorReporting = error_reporting();
        error_reporting(0);

        $width  = $this->width * $this->retinaMultiplier;
        $height = $this->height * $this->retinaMultiplier;
        $ext    = strtoupper(substr($this->extension, 1));

        if ($ext === 'JPEG') {
            $ext = 'jpg';
        }

        try {

            /**
             * Catch any output, don't want anything going to the browser unless
             * we're sure it's ok
             */

            ob_start();

            $PHPThumb = new \PHPThumb\GD($filePath, $_options);

            //  Prepare the parameters and call the method
            $aParams = [
                $width,
                $height,
                $this->cropQuadrant,
            ];

            call_user_func_array([$PHPThumb, $phpCropMethod], $aParams);

            //  Save cache version
            $PHPThumb->save($this->cdnCacheDir . $this->cdnCacheFile, $ext);

            //  Flush the buffer
            ob_end_clean();

        } catch (Exception $e) {

            //  Log the error
            Factory::service('Logger')->line('CDN: ' . $phpCropMethod . ': ' . $e->getMessage());

            //  Switch error reporting back how it was
            error_reporting($oldErrorReporting);

            //  Flush the buffer
            ob_end_clean();

            //  Bad SRC
            $this->serveBadSrc([
                'width'  => $width,
                'height' => $height,
            ]);
        }

        $this->serveFromCache($this->cdnCacheFile, false);

        //  Switch error reporting back how it was
        error_reporting($oldErrorReporting);
    }
1054838
public function resize($width = 0, $height = 0) 
    {
        if ($width != 0 || $height != 0) {
            $width = $this->getNewWidth($width, $height);
            $height = $this->getNewHeight($width, $height);
        } else {
            $width = $this->imageInfo['width'];
            $height = $this->imageInfo['height'];
        }

        $this->destImageWidth = $width;
        $this->destImageHeight = $height;
        
        return $this;
    }
634860
protected function resizeLandscape(ImageInterface $image, $width, $height)
    {
        // @codeCoverageIgnoreStart
        if (empty($width)) {
            throw new InvalidArgumentException(
                'Width value for portrait resize is empty. This may be caused by unfixed EXIF-rotated images.'
            );
        }
        // @codeCoverageIgnoreEnd

        $optimalHeight = $this->getSizeByFixedWidth($image, $width);

        $dimensions = $image->getSize()
            ->widen($width)
            ->heighten($optimalHeight);

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

        return $image;
    }
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;
    }
1366934
public function runMaxResize(Image $image, $width, $height)
    {
        return $image->resize($width, $height, function ($constraint) {
            $constraint->aspectRatio();
            $constraint->upsize();
        });
    }
582317
public function resizeFit(&$image, $newWidth, $newHeight)
    {

        $width  = $image->getWidth();
        $height = $image->getHeight();
        $ratio  = $width / $height;

        // Try basing it on width first
        $resizeWidth  = $newWidth;
        $resizeHeight = round($newWidth / $ratio);

        if (($resizeWidth > $newWidth) or ($resizeHeight > $newHeight)) { // Oops, either with or height does not fit
            // So base on height instead
            $resizeHeight = $newHeight;
            $resizeWidth  = $newHeight * $ratio;
        }

        $this->_resize($image, $resizeWidth, $resizeHeight);

        return $this;
    }
478921
public function saveImage($savePath, $imageQuality = '100')
    {
        $extension = strrchr($savePath, '.');
        $extension = strtolower($extension);

        switch ($extension) {
            case '.jpg':
            case '.jpeg':
                if (imagetypes() & IMG_JPG) {
                    imagejpeg($this->imageResized, $savePath, $imageQuality);
                }
                break;

            case '.gif':
                if (imagetypes() & IMG_GIF) {
                    imagegif($this->imageResized, $savePath);
                }
                break;

            case '.png':
                $scaleQuality = round(($imageQuality / 100) * 9);
                $invertScaleQuality = 9 - $scaleQuality;

                if (imagetypes() & IMG_PNG) {
                    imagepng($this->imageResized, $savePath, $invertScaleQuality);
                }
                break;

            default:
                break;
        }

        imagedestroy($this->imageResized);

        return $this;
    }
419610
protected function do_resize(\stdClass $src, $width, $height) {

		$src->resource->resizeImage($width, $height, \Imagick::FILTER_CATROM, 1, FALSE);
		$src->resource->convolveImage([-1, -0.8, -1, -0.8, 16, -0.8, -1, -0.8, -1]);
		
		$src->width		= $width;
		$src->height	= $height;

		return $src;
		
	}
542913
public function resizeTo(
        int $width,
        int $height,
        bool $maintain_aspect = true,
        array $canvas_color = array('r' => 255, 'g' => 255, 'b' => 255)
    ) : ImageResize
    {
        if ($this->resizer !== null) {
            try {
                $this->resizer->setOptions($width, $height, $this->quality, $maintain_aspect, $canvas_color);
            } catch (\Exception $e) {
                echo $e->getMessage();
            }
        }

        return $this;
    }
937587
private static function resizeImage($sourceFile, $destFile, $width) {
    $image = new \Gumlet\ImageResize($sourceFile);
    $image->resizeToWidth($width);
    $image->save($destFile);
  }
501575
public function resize(int $width = 0, int $height = 0)
    {
        $this->instance->scaleImage($width, $height);
    }
261215
public static function _Resize ($image, $newX, $newY, $method = self::RESIZE_MAX, $proportional = TRUE)
	{
		
		// Get original image sizes
		
		$origX	= imagesx ($image);
		$origY	= imagesy ($image);
		
		// Set canvas sizes
		
		$canvasX	= $newX;
		$canvasY	= $newY;
		
		// Switch method
		
		switch ($method)
		{
			
			// Maximum Resize
			
			case self::RESIZE_MAX:
				
				// If the width is relatively bigger than the height
				
				if ($origX / $newX > $origY / $newY)
				{
					
					// Resize the image so the width is the max
					
					$newY		= ($newX / $origX) * $origY;
					$canvasY	= $newY;
					
				}
				
				// Else the height is bigger than the width
				
				else
				{
					
					// Resize the image so the height is the max
					
					$newX		= ($newY / $origY) * $origX;
					$canvasX	= $newX;
					
				}
				
				// Break
				
				break;
				
			
			// Minimum resize
			
			case self::RESIZE_MIN:
				
				// If the width is relatively bigger than the height
				
				if ($origX / $newX > $origY / $newY)
				{
					
					// Resize the image so the height is the max
					
					$newX		= ($newY / $origY) * $origX;
					$canvasX	= $newX;
					
				}
				
				// Else the height is bigger than the width
				
				else
				{
					
					// Resize the image so the width is the max
					
					$newY		= ($newX / $origX) * $origY;
					$canvasY	= $newY;
					
				}
				
				// Break
				
				break;
				
			
			// Exact resize
			
			case self::RESIZE_EXACT:
				
				// If proportional
				
				if ($proportional)
				{
					
					// If the original width is bigger
					
					if ($origX / $newX > $origY / $newY)
					{
						
						// Resize the image so the width is the max
						
						$newY	= ($newX / $origX) * $origY;
						
					}
					
					// Else the height is bigger than the width
					
					else
					{
						
						// Resize the image so the height is the max
						
						$newX	= ($newY / $origY) * $origX;
						
					}
					
				}
				
				// Break
				
				break;


			// Exact resize with cropping

			case self::RESIZE_CROP:

				// If proportional

				if ($proportional)
				{

					// If the width is relatively bigger than the height

					if ($origX / $newX > $origY / $newY)
					{

						// Resize the image and crop

						$newX	= ($newY / $origY) * $origX;

					}

					// Else the height is bigger than the width

					else
					{

						// Resize the image and crop

						$newY	= ($newX / $origX) * $origY;

					}

				}

				// Break

				break;

		}
		
		// Calculate new image position to center
		
		$posX	= ($canvasX - $newX) / 2;
		$posY	= ($canvasY - $newY) / 2;

		// Copy image and create new resized image
		
		$newImage		= imagecreatetruecolor ($canvasX, $canvasY);
		
		// Set white colour
		
		$colourWhite	= imagecolorallocate ($newImage, 0xFF, 0xFF, 0xFF);
		
		// Set background
		
		imagefill ($newImage, 0, 0, $colourWhite);
		
		// Resize and resample image
		
		imagecopyresampled ($newImage, $image, $posX, $posY, 0, 0, $newX, $newY, $origX, $origY);
		
		// Return new image
		
		return $newImage;
		
	}
564521
public function resize($width, $height) {
        if (!$width) $width = 1;
        if (!$height) $height = 1;
        return (
            (false !== ($img = new gd(array($width, $height)))) &&
            $img->imagecopyresampled($this) &&
            (false !== ($this->image = $img->get_image())) &&
            (false !== ($this->width = $img->get_width())) &&
            (false !== ($this->height = $img->get_height()))
        );
    }
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;
    }
1015164
public static function resizeImage($file, $width, $height, $desFile = '')
    {
        try {
            if (is_file($file)) {
                if (!$desFile) {
                    $desFile = $file;
                }
                Image::open($file)->resize($width, $height)->save($desFile);
                return true;
            }
        } catch (Exception $e) {
        }
        return false;
    }