src/UI/Image/Processing.php
public function resize( $width, $height, $interpolate = TRUE )
	{
		if( !is_int( $width ) )
			throw new InvalidArgumentException( 'Width must be integer' );
		if( !is_int( $height ) )
			throw new InvalidArgumentException( 'Height must be integer' );
		if( $width < 1 )
			throw new OutOfRangeException( 'Width must be atleast 1' );
		if( $height < 1 )
			throw new OutOfRangeException( 'Height must be atleast 1' );
		if( $this->image->getWidth() == $width && $this->image->getHeight() == $height )
			return FALSE;
		if( $this->maxMegaPixels && $width * $height > $this->maxMegaPixels * 1024 * 1024 )
			throw new OutOfRangeException( 'Larger than '.$this->maxMegaPixels.'MP ('.$width.'x'.$heigth.')' );

		$image	= new UI_Image;
		$image->create( $width, $height );
		$image->setType( $this->image->getType() );

		$parameters	= array_merge(																	//  combine parameters from:
			array( $image->getResource(), $this->image->getResource() ),							//  target and source resources
			array( 0, 0, 0, 0 ),																	//  target and source start coordinates
			array( $width, $height ),																//  target width and height
			array( $this->image->getWidth(), $this->image->getHeight() )							//  source width and height
		);

		$function = $interpolate ? 'imagecopyresampled' : 'imagecopyresized';						//  function to use depending on interpolation
		$reflection	= new ReflectionFunction( $function );											//  reflect function
		$reflection->invokeArgs( $parameters );														//  call function with parameters

		$this->image->setResource( $image->getResource() );											//  replace held image resource object by result
		return TRUE;
	}
public function resize( $width, $height, $interpolate = TRUE )
	{
		if( !is_int( $width ) )
			throw new InvalidArgumentException( 'Width must be integer' );
		if( !is_int( $height ) )
			throw new InvalidArgumentException( 'Height must be integer' );
		if( $width < 1 )
			throw new OutOfRangeException( 'Width must be atleast 1' );
		if( $height < 1 )
			throw new OutOfRangeException( 'Height must be atleast 1' );
		if( $this->image->getWidth() == $width && $this->image->getHeight() == $height )
			return FALSE;
		if( $this->maxMegaPixels && $width * $height > $this->maxMegaPixels * 1024 * 1024 )
			throw new OutOfRangeException( 'Larger than '.$this->maxMegaPixels.'MP ('.$width.'x'.$heigth.')' );

		$image	= new UI_Image;
		$image->create( $width, $height );
		$image->setType( $this->image->getType() );

		$parameters	= array_merge(																	//  combine parameters from:
			array( $image->getResource(), $this->image->getResource() ),							//  target and source resources
			array( 0, 0, 0, 0 ),																	//  target and source start coordinates
			array( $width, $height ),																//  target width and height
			array( $this->image->getWidth(), $this->image->getHeight() )							//  source width and height
		);

		$function = $interpolate ? 'imagecopyresampled' : 'imagecopyresized';						//  function to use depending on interpolation
		$reflection	= new ReflectionFunction( $function );											//  reflect function
		$reflection->invokeArgs( $parameters );														//  call function with parameters

		$this->image->setResource( $image->getResource() );											//  replace held image resource object by result
		return TRUE;
	}
public function resize ( $ width , $ height , $ interpolate = TRUE ) { if ( ! is_int ( $ width ) ) throw new InvalidArgumentException ( 'Width must be integer' ) ; if ( ! is_int ( $ height ) ) throw new InvalidArgumentException ( 'Height must be integer' ) ; if ( $ width < 1 ) throw new OutOfRangeException ( 'Width must be atleast 1' ) ; if ( $ height < 1 ) throw new OutOfRangeException ( 'Height must be atleast 1' ) ; if ( $ this -> image -> getWidth ( ) == $ width && $ this -> image -> getHeight ( ) == $ height ) return FALSE ; if ( $ this -> maxMegaPixels && $ width * $ height > $ this -> maxMegaPixels * 1024 * 1024 ) throw new OutOfRangeException ( 'Larger than ' . $ this -> maxMegaPixels . 'MP (' . $ width . 'x' . $ heigth . ')' ) ; $ image = new UI_Image ; $ image -> create ( $ width , $ height ) ; $ image -> setType ( $ this -> image -> getType ( ) ) ; $ parameters = array_merge ( //  combine parameters from: array ( $ image -> getResource ( ) , $ this -> image -> getResource ( ) ) , //  target and source resources array ( 0 , 0 , 0 , 0 ) , //  target and source start coordinates array ( $ width , $ height ) , //  target width and height array ( $ this -> image -> getWidth ( ) , $ this -> image -> getHeight ( ) ) //  source width and height ) ; $ function = $ interpolate ? 'imagecopyresampled' : 'imagecopyresized' ; //  function to use depending on interpolation $ reflection = new ReflectionFunction ( $ function ) ; //  reflect function $ reflection -> invokeArgs ( $ parameters ) ; //  call function with parameters $ this -> image -> setResource ( $ image -> getResource ( ) ) ; //  replace held image resource object by result return TRUE ; }
Resizes image.
@access		public
@param		integer		$width			New width
@param		integer		$height			New height
@param		boolean		$interpolate	Flag: use interpolation
@return		boolean		Image has been resized
@throws		InvalidArgumentException if width is not an integer value
@throws		InvalidArgumentException if height is not an integer value
@throws		OutOfRangeException if width is lower than 1
@throws		OutOfRangeException if height is lower than 1
@throws		OutOfRangeException if resulting image has more mega pixels than allowed
Resizes image .