Function for scale image

@param integer $width
@param integer $height
@return \App\Helpers\Classes\SmartClass
547350
public function canvasImageResample($width, $height)
    {
        $oCanvas = imagecreatetruecolor($width, $height);
        imagecopyresampled($oCanvas, $this->oImg, 0, 0, 0, 0, $width, $height, imagesx($this->oImg), imagesy($this->oImg));
        $this->oImg = $oCanvas;
        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));
    }
584523
public function getMetaImageResized($width = null, $height = null, $method = null)
    {
        if ($this->owner->hasMetaImage()) {
            
            return ImageTools::singleton()->resize(
                $this->owner->getMetaImage(),
                $this->owner->getMetaImageResizeWidth($width),
                $this->owner->getMetaImageResizeHeight($height),
                $this->owner->getMetaImageResizeMethod($method)
            );
            
        }
    }
1366106
public function scaleTo($width=null, $height=null)
    {
        if (!$width && !$height) {
            throw new UnderflowException('You have to pass at least width or height.');
        }

        if ($width instanceof Size) {
            return new static($width->width(), $width->height());
        }

        if ($width && $height) {
            return new static($width, $height);
        }

        if (!$width) {
            return new static($height * $this->aspectRatio(), $height);
        }

        return new static($width, $width / $this->aspectRatio());

    }
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;
    }
1319234
public function paperSize($width,$height)
    {
        $this->paperWidth = $width;
        $this->paperHeight = $height;
        return $this;
    }
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'];
    }
941821
public function resize($width, $height, $x = 0, $y = 0)
    {
        if ( !$this->newImage )
        {
            $this->create($width, $height);
        }

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

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

        $type = $this->source['type'];

        imagecopyresampled(
            $this->newImage,
            $this->sourceImage,
            0, 0,
            $x, $y,
            $width, $height,
            $this->source['width'], $this->source['height']);

        return $this;
    }
1283642
public function setSize($width, $height)
    {
        $this->width = $width;
        $this->height = $height;

        return $this;
    }
1004578
public function resize($width = null, $height = null) {
        $params = array();

        if ($width) {
            $params[] = 'width=' . (int) $width;
        }

        if ($height) {
            $params[] = 'height=' . (int) $height;
        }

        if (!$params) {
            throw new InvalidArgumentException('width and/or height must be specified');
        }

        return $this->addTransformation(sprintf('resize:%s', implode(',', $params)));
    }
737215
public function croppedResize($width, $height)
    {
        return $this->createCloneWithResource(
            function (InterventionImage $resource) use ($width, $height) {
                return $resource->fit($width, $height);
            }
        );
    }
895159
protected function getImageSize($width, $height)
    {
        $min = min($width, $height);

        // if one value is zero, we have to calculate the right
        // value using the image aspect raion
        if (0 === $min) {

            // if both hight and widh are zero we assume
            // that the image is not resized at all
            if (0 === max($width, $height)) {
                extract($this->getInfo());
            } else {
                $ratio = $this->getInfo('ratio');
            }

            $width  = $width  === 0 ? (int) floor($height * $ratio) : $width;
            $height = $height === 0 ? (int) floor($width  / $ratio) : $height;
        }

        return compact('width', 'height');
    }
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;
	}
669101
public function manipulate(AbstractImage $image, $width, $height)
    {
        $box = $this->calculateResize($image, $width, $height);

        return $image->resize($box);
    }
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;
    }
242253
public function size(Int $width, Int $height) : Table
    {
        $this->attr['width']  = $width;
        $this->attr['height'] = $height;

        return $this;
    }
698986
public function create($width = null, $height = null)
    {
        $this->width  = ($width)  ? $width : $this->width;
        $this->height = ($height) ? $height : $this->height;

        $imageType    = $this->getImageType();
        $createFunc   = ($imageType === 'gif') ? 'imagecreate' : 'imagecreatetruecolor';
        $this->image  = $createFunc($this->width, $this->height);

        $bgColor = $this->backgroundColor;

        $backgroundColor = imagecolorallocate($this->image, $bgColor[0], $bgColor[1], $bgColor[2]);

        imagefilledrectangle($this->image, 0, 0, $this->width, $this->height, $backgroundColor);

        $this->drawText();

        if ($this->drawBorder)
        {
            $this->drawBorder();
        }

        if ($this->drawLine)
        {
            $this->drawLine();
        }

        if ($this->drawPixel)
        {
            $this->drawPixel();
        }

        return $this;
    }