Proxy function for the following double effects :
- resizeOut
- cropFromEdge
The result match will fit perfectly the ($width, $height) dimension
@param int $width
@param int $height
@return Abstract
548663
public function cropAndResizeFromEdge($width, $height, $edge)
        {
            $this->resizeOut($width, $height);
            $this->cropFromEdge($width, $height, $edge);

            return $this;
        }
825678
public function fit($width, $height)
    {
        $this->mode = 'resizeToFit';
        $this->targetSize = [$width, $height];
        $this->arguments = [];

        return $this->process();
    }
1152433
public function fit($width, $height)
    {
        $this->toggleModified();

        $this->getInterventionImage()->fit($width, $height);

        return $this;
    }
699395
public function Fit($width, $height)
    {
        $width = $this->castDimension($width, 'Width');
        $height = $this->castDimension($height, 'Height');
        // Item must be regenerated
        $variant = $this->variantName(__FUNCTION__, $width, $height);
        return $this->manipulateImage($variant, function (Image_Backend $backend) use ($width, $height) {
            // Check if image is already sized to the correct dimension
            $currentWidth = $backend->getWidth();
            $currentHeight = $backend->getHeight();
            if (!$currentWidth || !$currentHeight) {
                return null;
            }
            $widthRatio = $width / $currentWidth;
            $heightRatio = $height / $currentHeight;

            if ($widthRatio < $heightRatio) {
                // Target is higher aspect ratio than image, so check width
                if ($currentWidth === $width) {
                    return $this;
                }
            } else {
                // Target is wider or same aspect ratio as image, so check height
                if ($currentHeight === $height) {
                    return $this;
                }
            }

            return $backend->resizeRatio($width, $height);
        });
    }
235489
public function resizeOut($width, $height)
        {
            if (false === $this->_options['resizeUp']) {
                $this->_maxHeight = (intval($height) > $this->_sourceHeight) ? $this->_sourceHeight:$height;
                $this->_maxWidth = (intval($width) > $this->_sourceWidth) ? $this->_sourceWidth:$width;
            } else {
                $this->_maxHeight = intval($height);
                $this->_maxWidth = intval($width);
            }

            list($newWidth, $newHeight) = $this->_calcImageSizeStrict($this->_sourceWidth, $this->_sourceHeight);

            // resize the image to be close to our desired dimensions
            $this->resizeIn($newWidth, $newHeight);

            return $this;
        }
1118574
public function crop( $x, $y, $width, $height )
	{
		// check for auto
		if ( $x == 'center' || $x == 'auto' )
		{
			$x = ( $this->width / 2 ) - ( $width / 2 );
		}

		if ( $y == 'middle' || $y == 'auto' )
		{
			$y = ( $this->height / 2 ) - ( $height / 2 );
		}

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

		$this->image_context = $result;

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

		// return self
		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;
    }
250187
protected function getNewWidth($width, $height) 
    {
        if ($width > 0) {
            return $width;
        }
        
        // original height : new height = original width : X
        return $height * $this->imageInfo['width'] / $this->imageInfo['height'];
    }
1251185
public function resize($width, $height)
    {
        $new = imagecreatetruecolor($width, $height);

        if (empty($new)) {
            throw new UnexpectedValueException('Failed to create an image identifier');
        }

        if ($this->format === 'gif') {

            $transparent_index = imagecolortransparent($this->image);
            $palletsize = imagecolorstotal($this->image);

            if ($transparent_index >= 0 && $transparent_index < $palletsize) {
                $transparent_color = imagecolorsforindex($this->image, $transparent_index);
                $transparent_index = imagecolorallocate($new, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']);
                imagefill($new, 0, 0, $transparent_index);
                imagecolortransparent($new, $transparent_index);
            }
        } else {
            imagealphablending($new, false);
            imagesavealpha($new, true);
        }

        if (!imagecopyresampled($new, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height)) {
            throw new UnexpectedValueException('Failed to copy and resize part of an image with resampling');
        }

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

        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);
    }
445490
public function expandTo($width, $height=null)
    {
        $size = $width instanceof Size ? $width : new static($width, $height);

        if (!$size->isValid()) {
            return $this->scaleTo($size);
        }

        $myAspectRatio = $this->aspectRatio();

        $newWidth = $size->height() * $myAspectRatio;

        if ($newWidth >= $size->width()) {
            return new static($newWidth, $size->height());
        }

        return new static($size->width(), $size->width() / $myAspectRatio);
    }
709005
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);
    }
82107
public function crop($width, $height, $mode = 'tl')
    {
        if ( !is_numeric($width) ) {
            throw new \InvalidArgumentException('$width must be numeric');
        }

        if ( !is_numeric($height) ) {
            throw new \InvalidArgumentException('$height must be numeric');
        }

        if ( $this->newImage )
        {
            $this->sourceImage = $this->newImage;
        }

        $oldWidth   = ($this->newImage) ? imagesx($this->newImage) : $this->source['width'];
        $oldHeight  = ($this->newImage) ? imagesy($this->newImage) : $this->source['height'];

        $this->create($width, $height);

        $startX     = $startY = 0;
        $cropWidth  = $sourceWidth  = $width;
        $cropHeight = $sourceHeight = $height;

        if ( is_array($mode) )
        {
            $startX = $mode[0];
            $startY = $mode[1];
        }

        if ($mode === self::CROP_TOP_CENTER)
        {
            $startX = ($oldWidth - $cropWidth) / 2;
        }
        else if ($mode === self::CROP_TOP_RIGHT)
        {
            $startX = $oldWidth - $cropWidth;
        }
        else if ($mode === self::CROP_CENTER_LEFT)
        {
            $startY = ($oldHeight - $cropHeight) / 2;
        }
        else if ($mode === self::CROP_CENTER_CENTER)
        {
            $startX = ($oldWidth - $cropWidth)   / 2;
            $startY = ($oldHeight - $cropHeight) / 2;
        }
        else if ($mode === self::CROP_CENTER_RIGHT)
        {
            $startX = $oldWidth - $cropWidth;
            $startY = ($oldHeight - $cropHeight) / 2;
        }
        else if ($mode === self::CROP_BOTTOM_LEFT)
        {
            $startY = $oldHeight - $cropHeight;
        }
        else if ($mode === self::CROP_BOTTOM_CENTER)
        {
            $startX = ($oldWidth - $cropWidth)   / 2;
            $startY = $oldHeight - $cropHeight;
        }
        else if ($mode === self::CROP_BOTTOM_RIGHT)
        {
            $startX = $oldWidth - $cropWidth;
            $startY = $oldHeight - $cropHeight;
        }
        else
        {
        }

        imagecopyresampled(
            $this->newImage,
            $this->sourceImage,
            0, 0, $startX, $startY,
            $cropWidth, $cropHeight, $sourceWidth, $sourceHeight);

        return $this;
    }
452500
public function resize($width, $height, Closure $callback = null)
    {
        if (is_null($width) && is_null($height)) {
            throw new \Intervention\Image\Exception\InvalidArgumentException(
                "Width or height needs to be defined."
            );
        }

        // new size with dominant width
        $dominant_w_size = clone $this;
        $dominant_w_size->resizeHeight($height, $callback);
        $dominant_w_size->resizeWidth($width, $callback);

        // new size with dominant height
        $dominant_h_size = clone $this;
        $dominant_h_size->resizeWidth($width, $callback);
        $dominant_h_size->resizeHeight($height, $callback);

        // decide which size to use
        if ($dominant_h_size->fitsInto(new self($width, $height))) {
            $this->set($dominant_h_size->width, $dominant_h_size->height);
        } else {
            $this->set($dominant_w_size->width, $dominant_w_size->height);
        }

        return $this;
    }
41485
public function do_crop($width, $height, $offsetX = 0, $offsetY = 0)
    {
        if (version_compare(PHP_VERSION, '5.5.0') < 0) {
            $image = imagecreatetruecolor($width, $height);
            imagealphablending($image, false);
            imagesavealpha($image, true);
            imagecopy($image, $this->_image, 0, 0, $offsetX, $offsetY, $width, $height);
        } else {
            $rect = ['x' => $offsetX, 'y' => $offsetY, 'width' => $width, 'height' => $height];
            $image = imagecrop($this->_image, $rect);
        }

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

        return $this;
    }
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()))
        );
    }
314065
public function scaleResize($width, $height) {

        // calculate source coordinates
        $kw = $this->width() / $width;
        $kh = $this->height() / $height;
        if($kh < $kw) {
            $src_h = $this->height();
            $src_y = 0;
            $src_w = round($kh * $width);
            $src_x = round(($this->width() - $src_w) / 2);
        } else {
            $src_h = round($kh * $height);
            $src_y = round(($this->height() - $src_h) / 2);
            $src_w = $this->width();
            $src_x = 0;
        }

        // copy new image
        $new = imagecreatetruecolor($width, $height);
        imagecopyresampled($new, $this->resource, 0, 0, $src_x, $src_y,
            $width, $height, $src_w, $src_h);
        $this->resource = $new;

        // for method chaining
        return $this;
    }