{"record":{"id":"22bab1b178e5fafb","repo":"Intervention/image","slug":"failed-to-apply-intervention-image-drivers-gd-modi","errorCode":null,"errorMessage":"Failed to apply Intervention\\Image\\Drivers\\Gd\\Modifiers\\BlurModifier, unable to process blur effect","messagePattern":"Failed to apply Intervention\\\\Image\\\\Drivers\\\\Gd\\\\Modifiers\\\\BlurModifier, unable to process blur effect","errorType":"exception","errorClass":"ModifierException","httpStatus":null,"severity":"error","filePath":"src/Drivers/Gd/Modifiers/BlurModifier.php","lineNumber":27,"sourceCode":"use Intervention\\Image\\Interfaces\\SpecializedInterface;\nuse Intervention\\Image\\Modifiers\\BlurModifier as GenericBlurModifier;\n\nclass BlurModifier extends GenericBlurModifier implements SpecializedInterface\n{\n    /**\n     * {@inheritdoc}\n     *\n     * @see ModifierInterface::apply()\n     *\n     * @throws ModifierException\n     */\n    public function apply(ImageInterface $image): ImageInterface\n    {\n        foreach ($image as $frame) {\n            for ($i = 0; $i < $this->level; $i++) {\n                $result = imagefilter($frame->native(), IMG_FILTER_GAUSSIAN_BLUR);\n                if ($result === false) {\n                    throw new ModifierException(\n                        'Failed to apply ' . self::class . ', unable to process blur effect',\n                    );\n                }\n            }\n        }\n\n        return $image;\n    }\n}\n","sourceCodeStart":9,"sourceCodeEnd":37,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/Drivers/Gd/Modifiers/BlurModifier.php#L9-L37","documentation":"The blur modifier runs IMG_FILTER_GAUSSIAN_BLUR via imagefilter() once per level per frame; a false return is wrapped in ModifierException. GD returns false only when the filter cannot be applied to the given native, which for a valid truecolor GdImage essentially never happens.","triggerScenarios":"Applying ->blur(n) to a frame whose native is a degenerate or invalid GdImage (e.g. zero-sized or previously failed allocation); test environments that substitute or mock natives (testApplyThrowsWhenSpecializedWithoutOverride).","commonSituations":"Test/CI suites with specialized driver subclasses, images that slipped through a partially failed pipeline leaving broken natives, exotic or broken GD builds.","solutions":["Catch ModifierException and fail that single image gracefully instead of the batch","Verify the image decoded cleanly (no fallback/partial state) before modifiers","Re-encode or clone to a fresh truecolor native before blurring","Try the Imagick driver for consistent filter behavior across environments"],"exampleFix":"// before\n$image->blur(15);\n\n// after\ntry {\n    $image->blur(15);\n} catch (ModifierException $e) {\n    logs()->warning('blur failed', ['file' => $fileId]);\n    // ship unblurred variant or re-encode\n}","handlingStrategy":"try-catch","validationCode":"foreach ($image as $frame) {\n    if (!$frame->native() instanceof GdImage) {\n        throw new RuntimeException('Invalid frame native');\n    }\n}\n$image->blur(15);","typeGuard":"function isGdImage(mixed $value): bool\n{\n    return $value instanceof GdImage;\n}","tryCatchPattern":"try {\n    $image->blur(15);\n} catch (ModifierException $e) {\n    // log and ship unblurred variant, or re-encode to fresh truecolor and retry once\n}","preventionTips":["Validate decodes fully before chaining modifiers","Isolate per-image failures in batch processing","Keep test doubles consistent with real GdImage behavior"],"tags":["blur","imagefilter","modifier","gd"],"backgroundTag":"image-filter-failed","analyzedSha":"5598b9e39751c34afc5cdee84abef77f92c26f68","analyzedAt":"2026-08-23T02:17:31.068Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}