*/ public static function createTrueColorImage($width, $height) { return TrueColorImage::create($width, $height); } /** * Check whether the given handle is a valid GD resource * * @param mixed $handle The variable to check * @return bool */ public static function isValidImageHandle($handle) { return is_resource($handle) && get_resource_type($handle) == 'gd'; } /** * Throws exception if the handle isn't a valid GD resource * * @param mixed $handle The variable to check */ public static function assertValidImageHandle($handle) { if (!static::isValidImageHandle($handle)) { throw new InvalidImageHandleException("{$handle} is not a valid image handle."); } } } WideImage::checkGD(); WideImage::registerCustomMapper('\\WideImage\\Mapper\\BMP', 'image/bmp', 'bmp'); WideImage::registerCustomMapper('\\WideImage\\Mapper\\TGA', 'image/tga', 'tga');
*/ static function createTrueColorImage($width, $height) { return WideImage_TrueColorImage::create($width, $height); } /** * Check whether the given handle is a valid GD resource * * @param mixed $handle The variable to check * @return bool */ static function isValidImageHandle($handle) { return is_resource($handle) && get_resource_type($handle) == 'gd'; } /** * Throws exception if the handle isn't a valid GD resource * * @param mixed $handle The variable to check */ static function assertValidImageHandle($handle) { if (!self::isValidImageHandle($handle)) { throw new WideImage_InvalidImageHandleException("{$handle} is not a valid image handle."); } } } WideImage::checkGD(); WideImage::registerCustomMapper('WideImage_Mapper_BMP', 'image/bmp', 'bmp'); WideImage::registerCustomMapper('WideImage_Mapper_TGA', 'image/tga', 'tga');
public function testLoadFromFileFallbackToLoadFromString() { FOO::$handle = imagecreate(10, 10); $filename = IMG_PATH . 'image-actually-foo.foo2'; WideImage::registerCustomMapper('FOO', 'image/foo', 'foo'); WideImage::registerCustomMapper('FOO2', 'image/foo2', 'foo2'); $img = WideImage::load($filename); $this->assertEquals(FOO2::$calls['load'], array($filename)); $this->assertEquals(FOO::$calls['loadFromString'], array(file_get_contents($filename))); imagedestroy(FOO::$handle); }