{"record":{"id":"4833a0286809359e","repo":"PHPOffice/PhpSpreadsheet","slug":"unsupported-image-type-in-comment-background-supp","errorCode":null,"errorMessage":"Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.","messagePattern":"Unsupported image type in comment background\\. Supported types: PNG, JPEG, BMP, GIF\\.","errorType":"exception","errorClass":"PhpOffice\\PhpSpreadsheet\\Exception","httpStatus":null,"severity":"error","filePath":"src/PhpSpreadsheet/Comment.php","lineNumber":339,"sourceCode":"\n        return getimagesize($path) !== false;\n    }\n\n    /**\n     * Returns background image.\n     */\n    public function getBackgroundImage(): Drawing\n    {\n        return $this->backgroundImage;\n    }\n\n    /**\n     * Sets background image.\n     */\n    public function setBackgroundImage(Drawing $objDrawing): self\n    {\n        if (!array_key_exists($objDrawing->getType(), Drawing::IMAGE_TYPES_CONVERTION_MAP)) {\n            throw new PhpSpreadsheetException('Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.');\n        }\n        $this->backgroundImage = $objDrawing;\n\n        return $this;\n    }\n\n    /**\n     * Sets size of comment as size of background image.\n     */\n    public function setSizeAsBackgroundImage(): self\n    {\n        if ($this->hasBackgroundImage()) {\n            $this->setWidth(SharedDrawing::pixelsToPoints($this->backgroundImage->getWidth()) . 'pt');\n            $this->setHeight(SharedDrawing::pixelsToPoints($this->backgroundImage->getHeight()) . 'pt');\n        }\n\n        return $this;\n    }","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/PHPOffice/PhpSpreadsheet/blob/65b080eef4d9fd11a5796135ab145883e5c3d6a6/src/PhpSpreadsheet/Comment.php#L321-L357","documentation":"Error \"Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.\" thrown in PHPOffice/PhpSpreadsheet.","triggerScenarios":"Thrown at src/PhpSpreadsheet/Comment.php:339 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"65b080eef4d9fd11a5796135ab145883e5c3d6a6","analyzedAt":"2026-08-17T05:40:41.646Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}