Resize image proportionally basing on the width of the image.

@access public
@param int $width
@return \GImage\Image
965152
public function resizeToWidth($width)
    {
        $height = $this->getPropHeight($width);
        $this->resize($width, $height);

        return $this;
    }
1026103
public function setWidth($width)
    {
        if (!is_null($width)) {
            if (intval($width) < 0) {
                throw new \InvalidArgumentException(sprintf('Invalid width: %d', $width));
            }

            $this->width = intval($width);
        } else {
            $this->width = null;
        }

        return $this;
    }
529451
public function setWidth( int $width ) : ImageSizeReducer
   {

      if ( $width <= 0 )
      {
         throw new ArgumentError( 'width', $width, 'Drawing.Image', 'Can not crop an image with an empty width!' );
      }

      $this->data[ 'width' ] = $width;

      return $this;

   }
1283850
private function resizeGd($resource)
    {
        $origWidth  = imagesx($resource);
        $origHeight = imagesy($resource);

        if(!$this->resizeSmaller && $this->height > $origHeight && $this->width > $origWidth)
        {
            return $resource;
        }

        $resizeX = 0;
        $resizeY = 0;

        $realWidth  = $this->width;
        $realHeight = $this->height;

        if($this->resizeMode === $this::MODE_FILL)
        {
            $ratioH = $this->height / $origHeight;
            $ratioW = $this->width / $origWidth;

            $width  = max($origWidth * $ratioH, $origWidth * $ratioW);
            $height = max($origHeight * $ratioH, $origHeight * $ratioW);
            $ratio  = max($width / $origWidth, $height / $origHeight);

            $realWidth  = round($origWidth * $ratio);
            $realHeight = round($origHeight * $ratio);
        }
        elseif($this->resizeMode === $this::MODE_EXACT)
        {
            $ratioW = $this->width / $origWidth;
            $ratioH = $this->height / $origHeight;

            $exactRatio = min($ratioW, $ratioH);

            $resizeWidth  = round($origWidth * $exactRatio);
            $resizeHeight = round($origHeight * $exactRatio);

            $resizeX = floor(($this->width - $resizeWidth) / 2);
            $resizeY = floor(($this->height - $resizeHeight) / 2);

            $pictureResized = imagecreatetruecolor($this->width, $this->height);

            imagealphablending($pictureResized, TRUE);

            if(!$this->color || $this->color === 'transparent') {

                $color = imagecolorallocatealpha($pictureResized, 0, 0, 0, 127);
            }
            else {

                $rgb = $this->hex2rgb($this->color);

                $color = imagecolorallocate($pictureResized, $rgb[0], $rgb[1], $rgb[2]);
            }

            imagefill($pictureResized, 0, 0, $color);

            imagesavealpha($pictureResized, true);

            imagecopyresampled($pictureResized, $resource, $resizeX, $resizeY, 0, 0, $resizeWidth, $resizeHeight, $origWidth, $origHeight);

            return $pictureResized;
        }
        elseif($this->resizeMode === $this::MODE_CROP)
        {
            if(($origWidth / $origHeight) > ($this->width / $this->height)) {

                $widthTmp = $origHeight * $this->width / $this->height;

                $resizeX = ($origWidth - $widthTmp) / 2;
                $origWidth = $widthTmp;
            }
            elseif(($origWidth / $origHeight) < ($this->width / $this->height)) {

                $heightTmp = $origWidth * $this->height / $this->width;

                $resizeY = ($origHeight - $heightTmp) / 2;
                $origHeight = $heightTmp;
            }
        }
        // DEFAULT RESIZE METHOD FIT
        elseif($this->resizeMode !== $this::MODE_STRETCH)
        {
            $widthRatio  = $origWidth / $this->width;
            $heightRatio = $origHeight / $this->height;

            $resizeRatio = max($widthRatio, $heightRatio);

            $realWidth  = floor($origWidth / $resizeRatio);
            $realHeight = floor($origHeight / $resizeRatio);
        }

        $pictureResized   = imagecreatetruecolor($realWidth, $realHeight);
        $transparentColor = imagecolorallocatealpha($pictureResized, 0, 0, 0, 127);

        imagefill($pictureResized, 0, 0, $transparentColor);

        imagesavealpha($pictureResized, true);

        imagecopyresampled($pictureResized, $resource, 0, 0, $resizeX, $resizeY, $realWidth, $realHeight, $origWidth, $origHeight);

        return $pictureResized;
    }
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()))
        );
    }
101756
public function filterMaxWidth($width)
    {
        return $this->filter(
            function ($key, $value) use ($width) {
                if ($value instanceof ImageFilter && $value->getWidth() <= $width && $value->getWidth() !== null) {
                    return true;
                }
            }
        );
    }
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;
    }
390287
public function setWidth($width) {
		if (\is_int($width)) {
			$width=Wide::getConstants()["W" . $width];
		}
		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
		return $this->addToPropertyCtrl("class", "item", array ("item" ));
	}
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;
    }
253342
public function scale(Int $width, Int $height = -1, String $mode = 'bilinearFixed') : GD
    {
        $this->canvas = imagescale($this->canvas, $width, $height, Helper::toConstant($mode, 'IMG_'));

        return $this;
    }
1094941
protected function thumbnailResize(Image $image, $width, $height)
    {
        return $image->resize($width, $height, function ($constraint) {
            $constraint->aspectRatio();
        });
    }
498464
public function setImageMaxWidth($v)
    {
        if ($v !== null) {
            $v = (double) $v;
        }

        if ($this->image_max_width !== $v) {
            $this->image_max_width = $v;
            $this->modifiedColumns[AttributeTypeTableMap::IMAGE_MAX_WIDTH] = true;
        }


        return $this;
    }
398632
public function getMetaImageResizeWidth($width = null)
    {
        if ($width) {
            return $width;
        }
        
        if ($width = $this->owner->ImageMetaResizeWidth) {
            return $width;
        }
        
        return $this->owner->getFieldFromParent('DefaultImageResizeWidth');
    }
973922
public function resize($width, $height)
    {

        $new = imagecreatetruecolor($width, $height);
        imagealphablending($new, false);
        imagesavealpha($new, true);
        imagecopyresampled($new, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height);

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

        return $this;

    }
1130336
public function forceResize($width = null, $height = null, $background = 'transparent')
    {
        return $this->resize($width, $height, $background, true);
    }
716267
public function resize(Int $width, Int $height) : Thumb
    {
        $this->sets['rewidth']  = $width;
        $this->sets['reheight'] = $height;

        return $this;
    }
1057398
public function setWidth($width)
    {
        foreach ($this->results as $name) {
            $this->columns->offsetGet($name)->setWidth($width);
        }

        return $this;
    }