Esempio n. 1
0
	/**
	 * Resizes image.
	 * @param  mixed  width in pixels or percent
	 * @param  mixed  height in pixels or percent
	 * @param  int    flags
	 * @return ImageMagick  provides a fluent interface
	 */
	public function resize($width, $height, $flags = self::FIT)
	{
		if ($this->file === NULL) {
			return parent::resize($width, $height, $flags);
		}

		$mirror = '';
		if ($width < 0) $mirror .= ' -flop';
		if ($height < 0) $mirror .= ' -flip';
		list($newWidth, $newHeight) = self::calculateSize($this->getWidth(), $this->getHeight(), $width, $height, $flags);
		$this->execute("convert -resize {$newWidth}x{$newHeight}! {$mirror} -strip %input %output", self::PNG);
		return $this;
	}