{"record":{"id":"00499b490a2df4ca","repo":"Intervention/image","slug":"width-must-be-greater-than-or-equal-to-1","errorCode":null,"errorMessage":"Width must be greater than or equal to 1","messagePattern":"Width must be greater than or equal to 1","errorType":"exception","errorClass":"Intervention\\Image\\Exceptions\\InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Geometry/Tools/Resizer.php","lineNumber":23,"sourceCode":"namespace Intervention\\Image\\Geometry\\Tools;\n\nuse Intervention\\Image\\Alignment;\nuse Intervention\\Image\\Exceptions\\InvalidArgumentException;\nuse Intervention\\Image\\Exceptions\\StateException;\nuse Intervention\\Image\\Interfaces\\SizeInterface;\nuse Intervention\\Image\\Size;\n\nclass Resizer\n{\n    /**\n     * @throws InvalidArgumentException\n     */\n    public function __construct(\n        protected ?int $width = null,\n        protected ?int $height = null,\n    ) {\n        if (is_int($width) && $width < 1) {\n            throw new InvalidArgumentException(\n                'Width must be greater than or equal to 1',\n            );\n        }\n\n        if (is_int($height) && $height < 1) {\n            throw new InvalidArgumentException(\n                'Height must be greater than or equal to 1',\n            );\n        }\n    }\n\n    /**\n     * Static factory method to create resizer with given target size.\n     *\n     * @throws InvalidArgumentException\n     */\n    public static function to(?int $width = null, ?int $height = null): self\n    {","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/Geometry/Tools/Resizer.php#L5-L41","documentation":"Error \"Width must be greater than or equal to 1\" thrown in Intervention/image.","triggerScenarios":"Thrown at src/Geometry/Tools/Resizer.php:23 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Construct the Resizer with a width of at least 1","If the width comes from a scaled computation, round up and clamp: max(1, (int) round($width))","Reject zero/negative resize targets at the call site before building the Resizer"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5598b9e39751c34afc5cdee84abef77f92c26f68","analyzedAt":"2026-08-23T02:17:31.068Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}