Create a thumbnail in same directory as original image.

@param integer $width
@param integer $height
@param string $prefix
@return string - filename of created thumbnail.
@throws Exception
354534
public function createThumbnail($width, $height, $prefix = 'thumb_') {
	 	return $this->imageProcessor->createThumbnail($width, $height, $prefix);
	 }
863524
public static function transparentImage(int $width, int $height): Image {
        $image = imagecreatetruecolor(max($width, 1), max($height, 1));
        $transparent = imagecolorallocatealpha($image, 0, 0, 0, 127);
        imagefill($image, 0, 0, $transparent);
        imagesavealpha($image, true);

        return new Image($image);
    }
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;
    }
1330572
public function thumb($url, $width, $height = null)
    {
        return $this->resize($url, $width, $height, true);
    }
728622
public function canvas($width, $height, $background = null)
    {
        return $this->createDriver()->newImage($width, $height, $background);
    }
166135
protected function createCanvas($width, $height)
    {
        // Create the canvas element
        $canvas = imagecreatetruecolor( $width, $height );

        // Check if we should preserve the transparency
        if ( $this->imageType == IMAGETYPE_GIF || $this->imageType == IMAGETYPE_PNG ) {
            imagealphablending( $canvas, false );
            imagesavealpha( $canvas, true );
        }

        // Return the canvas
        return $canvas;
    }
737215
public function croppedResize($width, $height)
    {
        return $this->createCloneWithResource(
            function (InterventionImage $resource) use ($width, $height) {
                return $resource->fit($width, $height);
            }
        );
    }
728534
protected function imageThumb($width, $height)
    {
        $width = (int) $width;
        $height = (int) $height;
        if ($width <= 0) {
            throw new BadMethodCallException('Invalid parameter width for command "thumb"');
        }
        if ($height <= 0) {
            throw new BadMethodCallException('Invalid parameter height for command "thumb"');
        }
        $this->image = $this->image->thumbnail(new Box($width, $height));
    }
1072018
public function resize($width, $height) {

        $new = @imagecreatetruecolor($width, $height);

        // This needed to deal with .png transparency
        imagealphablending($new, false);
        imagesavealpha($new, true);
        $transparent = imagecolorallocatealpha($new, 255, 255, 255, 127);
        imagefilledrectangle($new, 0, 0, $width, $height, $transparent);

        imagecopyresampled($new, $this->resource, 0, 0, 0, 0, $width, $height,
            $this->width(), $this->height());
        $this->resource = $new;

        // for method chaining
        return $this;
    }
1209668
protected function imageResize($width, $height)
    {
        $width = (int) $width;
        $height = (int) $height;
        if ($width <= 0) {
            throw new BadMethodCallException('Invalid parameter width for command "resize"');
        }
        if ($height <= 0) {
            throw new BadMethodCallException('Invalid parameter height for command "resize"');
        }
        $this->image->resize(new Box($width, $height));
    }
1237175
public function resize( $width = null, $height = null )
    {
        // Get the source width and height
        $sourceWidth = imagesx( $this->image );
        $sourceHeight = imagesy( $this->image );

        // Check if any of the width and height is null, and set it to the $source size
        // $width = $width ?: $sourceWidth;
        // $height = $height ?: $sourceHeight;
        $sourceAspectRatio = $sourceWidth / $sourceHeight;

        if ( !$width && !$height ) {
            $width = $sourceWidth;
            $height = $sourceHeight;
        }
        else if ( ! $width ) {
            $width = $height * $sourceAspectRatio;
        }
        else {
            $height = $width / $sourceAspectRatio;
        }

        $maxCanvasWidth = $width;
        $maxCanvasHeight = $height;

        $thumbnailAspectRatio = $maxCanvasWidth / $maxCanvasHeight;

        // Create canvas for the new image
        $canvas = $this->createCanvas( $width, $height );

        // Do the resizing of the image
        imagecopyresampled($canvas, $this->image, 0, 0, 0, 0, $width, $height, $sourceWidth, $sourceHeight);

        // Replace the current image
        $this->replace( $canvas );

        // Return this for linking
        return $this;
    }
229588
public function do_resize($width, $height)
    {
        $this->_image->scaleImage($width, $height);

        $this->_width = $this->_image->getImageWidth();
        $this->_height = $this->_image->getImageHeight();

        return $this;
    }
431572
public function newImage($width, $height, $background = null)
    {
        // create empty resource
        $core = imagecreatetruecolor($width, $height);
        $image = new \Intervention\Image\Image(new static, $core);

        // set background color
        $background = new Color($background);
        imagefill($image->getCore(), 0, 0, $background->getInt());

        return $image;
    }
10381
public function size(Int $width, Int $height) : Thumb
    {
        $this->sets['width']  = $width;
        $this->sets['height'] = $height;

        return $this;
    }
21016
public function newImage($width, $height, $background = null)
    {
        $background = new Color($background);

        // create empty core
        $core = new \Imagick;
        $core->newImage($width, $height, $background->getPixel(), 'png');
        $core->setType(\Imagick::IMGTYPE_UNDEFINED);
        $core->setImageType(\Imagick::IMGTYPE_UNDEFINED);
        $core->setColorspace(\Imagick::COLORSPACE_UNDEFINED);

        // build image
        return new Image(new static, $core);
    }
314483
protected function urlForSize($width, $height=null)
    {

        if (!$this->sizes) {
            return $this->getUrl();
        }

        $targetSize = $width instanceof Size ? $width : new Size($width, $height);
        $targetKey = "$targetSize";

        if (isset($this->optimalSizeCache[$targetKey])) {
            return $this->optimalSizeCache[$targetKey];
        }

        $optimalSize = $targetSize->findBest($this->sizes());

        if ($this->getSize()->equals($optimalSize)) {
            $this->optimalSizeCache[$targetKey] = $this->getUrl();
            return $this->optimalSizeCache[$targetKey];
        }

        $optimalKey = "$optimalSize";

        if (isset($this->sizeUrls[$optimalKey])) {
            $this->optimalSizeCache[$targetKey] = $this->sizeUrls[$optimalKey];
            return $this->optimalSizeCache[$targetKey];
        }

        return $this->getUrl();

    }
57648
public function newImage($width, $height, $background = 'white')
    {
        $this->resource->createNew($width, $height, $background);

        return $this;
    }