public function generateThumbs($thumbSizes, $creationMethod = self::SCALE_INSIDE)
	{
		// Make sure the resource handle is valid.
		if (!$this->isLoaded())
		{
			throw new \LogicException('No valid image was loaded.');
		}

		// Accept a single thumbsize string as parameter
		if (!is_array($thumbSizes))
		{
			$thumbSizes = array($thumbSizes);
		}

		// Process thumbs
		$generated = array();

		if (!empty($thumbSizes))
		{
			foreach ($thumbSizes as $thumbSize)
			{
				// Desired thumbnail size
				$size = explode('x', strtolower($thumbSize));

				if (count($size) != 2)
				{
					throw new \InvalidArgumentException('Invalid thumb size received: ' . $thumbSize);
				}

				$thumbWidth  = $size[0];
				$thumbHeight = $size[1];

				switch ($creationMethod)
				{
					// Case for self::CROP
					case 4:
						$thumb = $this->crop($thumbWidth, $thumbHeight, null, null, true);
						break;

					// Case for self::CROP_RESIZE
					case 5:
						$thumb = $this->cropResize($thumbWidth, $thumbHeight, true);
						break;

					default:
						$thumb = $this->resize($thumbWidth, $thumbHeight, true, $creationMethod);
						break;
				}

				// Store the thumb in the results array
				$generated[] = $thumb;
			}
		}

		return $generated;
	}
public function generateThumbs($thumbSizes, $creationMethod = self::SCALE_INSIDE)
	{
		// Make sure the resource handle is valid.
		if (!$this->isLoaded())
		{
			throw new \LogicException('No valid image was loaded.');
		}

		// Accept a single thumbsize string as parameter
		if (!is_array($thumbSizes))
		{
			$thumbSizes = array($thumbSizes);
		}

		// Process thumbs
		$generated = array();

		if (!empty($thumbSizes))
		{
			foreach ($thumbSizes as $thumbSize)
			{
				// Desired thumbnail size
				$size = explode('x', strtolower($thumbSize));

				if (count($size) != 2)
				{
					throw new \InvalidArgumentException('Invalid thumb size received: ' . $thumbSize);
				}

				$thumbWidth  = $size[0];
				$thumbHeight = $size[1];

				switch ($creationMethod)
				{
					// Case for self::CROP
					case 4:
						$thumb = $this->crop($thumbWidth, $thumbHeight, null, null, true);
						break;

					// Case for self::CROP_RESIZE
					case 5:
						$thumb = $this->cropResize($thumbWidth, $thumbHeight, true);
						break;

					default:
						$thumb = $this->resize($thumbWidth, $thumbHeight, true, $creationMethod);
						break;
				}

				// Store the thumb in the results array
				$generated[] = $thumb;
			}
		}

		return $generated;
	}
public function generateThumbs ( $ thumbSizes , $ creationMethod = self :: SCALE_INSIDE ) { // Make sure the resource handle is valid. if ( ! $ this -> isLoaded ( ) ) { throw new \ LogicException ( 'No valid image was loaded.' ) ; } // Accept a single thumbsize string as parameter if ( ! is_array ( $ thumbSizes ) ) { $ thumbSizes = array ( $ thumbSizes ) ; } // Process thumbs $ generated = array ( ) ; if ( ! empty ( $ thumbSizes ) ) { foreach ( $ thumbSizes as $ thumbSize ) { // Desired thumbnail size $ size = explode ( 'x' , strtolower ( $ thumbSize ) ) ; if ( count ( $ size ) != 2 ) { throw new \ InvalidArgumentException ( 'Invalid thumb size received: ' . $ thumbSize ) ; } $ thumbWidth = $ size [ 0 ] ; $ thumbHeight = $ size [ 1 ] ; switch ( $ creationMethod ) { // Case for self::CROP case 4 : $ thumb = $ this -> crop ( $ thumbWidth , $ thumbHeight , null , null , true ) ; break ; // Case for self::CROP_RESIZE case 5 : $ thumb = $ this -> cropResize ( $ thumbWidth , $ thumbHeight , true ) ; break ; default : $ thumb = $ this -> resize ( $ thumbWidth , $ thumbHeight , true , $ creationMethod ) ; break ; } // Store the thumb in the results array $ generated [ ] = $ thumb ; } } return $ generated ; }
Method to generate thumbnails from the current image. It allows
creation by resizing or cropping the original image.

@param   mixed    $thumbSizes      String or array of strings. Example: $thumbSizes = array('150x75','250x150');
@param   integer  $creationMethod  1-3 resize $scaleMethod | 4 create croppping | 5 resize then crop

@return  array

@since   1.0
@throws  \LogicException
@throws  \InvalidArgumentException
Method to generate thumbnails from the current image . It allows creation by resizing or cropping the original image .