src/UI/Image/ThumbnailCreator.php
public function thumbize( $width, $height )
	{
		if( !count( $this->size ) )
			throw new RuntimeException( 'No Source Image set.' );

		$thumb	= imagecreatetruecolor( $width, $height );
		if( function_exists( 'imageantialias' ) )
			imageantialias( $thumb, TRUE );

		switch( $this->size[2] )
		{
			case 1:      //GIF
				$source	= imagecreatefromgif( $this->source );
				imagecopyresampled( $thumb, $source, 0, 0, 0, 0, $width, $height, $this->size[0], $this->size[1] );
				imagegif( $thumb, $this->target );
				break;
			case 2:      //JPEG
				$source	= imagecreatefromjpeg( $this->source );
				imagecopyresampled( $thumb, $source, 0, 0, 0, 0, $width, $height, $this->size[0], $this->size[1] );
				imagejpeg( $thumb, $this->target, $this->quality );
				break;
			case 3:      //PNG
				$source	= imagecreatefrompng( $this->source );
				imagecopyresampled( $thumb, $source, 0, 0, 0, 0, $width, $height, $this->size[0], $this->size[1] );
				imagepng( $thumb, $this->target );
				break;
			default:
				throw new Exception( 'Image Type is no supported.' );
		}
		return true;
	}
public function thumbize( $width, $height )
	{
		if( !count( $this->size ) )
			throw new RuntimeException( 'No Source Image set.' );

		$thumb	= imagecreatetruecolor( $width, $height );
		if( function_exists( 'imageantialias' ) )
			imageantialias( $thumb, TRUE );

		switch( $this->size[2] )
		{
			case 1:      //GIF
				$source	= imagecreatefromgif( $this->source );
				imagecopyresampled( $thumb, $source, 0, 0, 0, 0, $width, $height, $this->size[0], $this->size[1] );
				imagegif( $thumb, $this->target );
				break;
			case 2:      //JPEG
				$source	= imagecreatefromjpeg( $this->source );
				imagecopyresampled( $thumb, $source, 0, 0, 0, 0, $width, $height, $this->size[0], $this->size[1] );
				imagejpeg( $thumb, $this->target, $this->quality );
				break;
			case 3:      //PNG
				$source	= imagecreatefrompng( $this->source );
				imagecopyresampled( $thumb, $source, 0, 0, 0, 0, $width, $height, $this->size[0], $this->size[1] );
				imagepng( $thumb, $this->target );
				break;
			default:
				throw new Exception( 'Image Type is no supported.' );
		}
		return true;
	}
public function thumbize ( $ width , $ height ) { if ( ! count ( $ this -> size ) ) throw new RuntimeException ( 'No Source Image set.' ) ; $ thumb = imagecreatetruecolor ( $ width , $ height ) ; if ( function_exists ( 'imageantialias' ) ) imageantialias ( $ thumb , TRUE ) ; switch ( $ this -> size [ 2 ] ) { case 1 : //GIF
 $ source = imagecreatefromgif ( $ this -> source ) ; imagecopyresampled ( $ thumb , $ source , 0 , 0 , 0 , 0 , $ width , $ height , $ this -> size [ 0 ] , $ this -> size [ 1 ] ) ; imagegif ( $ thumb , $ this -> target ) ; break ; case 2 : //JPEG
 $ source = imagecreatefromjpeg ( $ this -> source ) ; imagecopyresampled ( $ thumb , $ source , 0 , 0 , 0 , 0 , $ width , $ height , $ this -> size [ 0 ] , $ this -> size [ 1 ] ) ; imagejpeg ( $ thumb , $ this -> target , $ this -> quality ) ; break ; case 3 : //PNG
 $ source = imagecreatefrompng ( $ this -> source ) ; imagecopyresampled ( $ thumb , $ source , 0 , 0 , 0 , 0 , $ width , $ height , $ this -> size [ 0 ] , $ this -> size [ 1 ] ) ; imagepng ( $ thumb , $ this -> target ) ; break ; default : throw new Exception ( 'Image Type is no supported.' ) ; } return true ; }
Resizes Image to a given Size.
@access		public
@param		int			$width 		Width of Target Image
@param		int			$height 	Height of Target Image
@return		bool
Resizes Image to a given Size .