public static function create($filename = null, $options = array(), $isDataStream = false)
{
// map our implementation to their class names
$implementationMap = array('imagick' => 'ImagickThumb', 'gd' => 'GdThumb');
// grab an instance of PhpThumb
$pt = PhpThumb::getInstance();
// load the plugins
$pt->loadPlugins(self::$pluginPath);
$toReturn = null;
$implementation = self::$defaultImplemenation;
// attempt to load the default implementation
if ($pt->isValidImplementation(self::$defaultImplemenation)) {
$imp = $implementationMap[self::$defaultImplemenation];
$toReturn = new $imp($filename, $options, $isDataStream);
} elseif ($pt->isValidImplementation('gd')) {
$imp = $implementationMap['gd'];
$implementation = 'gd';
$toReturn = new $imp($filename, $options, $isDataStream);
} else {
throw new Exception('You must have either the GD or iMagick extension loaded to use this library');
}
$registry = $pt->getPluginRegistry($implementation);
$toReturn->importPlugins($registry);
return $toReturn;
}