{"record":{"id":"f23a4291219f04c3","repo":"Intervention/image","slug":"class-objectshortname-is-not-supported-by-id","errorCode":null,"errorMessage":"Class '{objectShortname}' is not supported by {id} driver","messagePattern":"Class '(.+?)' is not supported by (.+?) driver","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Drivers/AbstractDriver.php","lineNumber":191,"sourceCode":"        }\n\n        // resolve classname for specializable object\n        $objectShortname = substr($object::class, (int) strrpos($object::class, '\\\\') + 1);\n\n        $specializedClassname = implode(\"\\\\\", [\n            substr($this::class, 0, (int) strrpos($this::class, '\\\\')), // driver's namespace\n            match (true) {\n                $object instanceof ModifierInterface => 'Modifiers',\n                $object instanceof AnalyzerInterface => 'Analyzers',\n                $object instanceof EncoderInterface => 'Encoders',\n                $object instanceof DecoderInterface => 'Decoders',\n            },\n            $objectShortname,\n        ]);\n\n        // fail if driver specialized classname does not exists\n        if (!class_exists($specializedClassname)) {\n            throw new NotSupportedException(\n                \"Class '\" . $objectShortname . \"' is not supported by \" . $this->id() . \" driver\",\n            );\n        }\n\n        // create a driver specialized object with the specializable properties of generic object\n        $specialized = new $specializedClassname(...$object->specializationArguments());\n\n        // attach driver\n        return $specialized->setDriver($this);\n    }\n}\n","sourceCodeStart":173,"sourceCodeEnd":203,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/Drivers/AbstractDriver.php#L173-L203","documentation":"Drivers map generic modifiers/analyzers/encoders/decoders to driver-specific classes by naming convention: the same short class name under the driver's namespace (e.g. Gd\\Modifiers\\ResizeModifier). If that specialized class does not exist for the active driver, specialize() throws NotSupportedException. A generic class without a matching implementation for your driver cannot be applied.","triggerScenarios":"Running the Imagick driver and applying a modifier/analyzer/encoder that only ships Gd-specific classes (or vice versa); a custom modifier whose specialized class is in the wrong namespace or misnamed relative to the convention.","commonSituations":"Third-party or in-house modifiers written for one driver only; copying a built-in specialized class into a custom namespace where the naming convention breaks.","solutions":["Check the package of the modifier/analyzer/encoder for driver support and install or enable the implementation for your driver","Switch the ImageManager to a driver the extension supports (new ImageManager(driver: ...))","For your own generic classes, place the specialized class in the matching driver namespace (e.g. Drivers\\Gd\\Modifiers\\YourModifier) with the same short name"],"exampleFix":"// before: custom modifier only exists for Gd\n$manager = new ImageManager(new DriverManager('Imagick'), ...);\n\n// after\n$manager = new ImageManager(driver: new \\Intervention\\Image\\Drivers\\Gd\\Driver());","handlingStrategy":"validation","validationCode":"$modifierClass = get_class($modifier);\n$specialized = str_replace('\\\\' . basename(str_replace('\\\\', '/', $modifierClass)), '', $modifierClass);\n// simplest guard: catch and surface which driver is missing support","typeGuard":null,"tryCatchPattern":"try {\n    $image->apply($modifier);\n} catch (NotSupportedException $e) {\n    // message names the class and driver - switch driver or add the specialized class\n}","preventionTips":["Verify third-party modifiers support your driver (Gd vs Imagick) before adopting them","Follow the Drivers\\<Driver>\\Modifiers|Encoders|Analyzers namespace convention for specialized classes","Test custom generic classes against every driver you ship"],"tags":["driver","modifier","extension","gd","imagick"],"backgroundTag":"driver-not-supported","analyzedSha":"5598b9e39751c34afc5cdee84abef77f92c26f68","analyzedAt":"2026-08-23T02:17:31.068Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}