php
runtime_error
ai_generated
partial
致命错误:未捕获的 ImagickException:不支持的图像格式 /tmp/phpXXXXXX,位于 /var/www/app/src/Image/Converter.php 第 12 行
Fatal error: Uncaught ImagickException: Unsupported image format /tmp/phpXXXXXX in /var/www/app/src/Image/Converter.php:12
ID: php/imagick-format-not-supported
80%修复率
86%置信度
1证据数
2024-03-05首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| php 8.1 | active | — | — | — |
| php 8.2 | active | — | — | — |
| ImageMagick 7.1 | active | — | — | — |
| Imagick 3.7 | active | — | — | — |
根因分析
ImageMagick 库无法解码给定文件,因为格式不被识别、文件损坏,或 ImageMagick 安装缺少对所需格式的支持(例如 HEIC、WebP)。
English
The ImageMagick library cannot decode the given file because the format is not recognized, the file is corrupt, or the ImageMagick installation lacks support for the required format (e.g., HEIC, WebP).
官方文档
https://imagemagick.org/script/formats.php解决方案
-
Check supported formats with `convert -list format` on the server, then install missing delegates, e.g., `apt-get install libheif-dev` and recompile ImageMagick.
-
Convert the file to a supported format before processing using an external tool like `ffmpeg` or `gd` as a fallback.
无效尝试
常见但无效的做法:
-
Reinstalling the Imagick PHP extension without updating ImageMagick
85% 失败
The PHP extension is just a wrapper; the underlying ImageMagick library must be installed with the required delegates (e.g., libheif for HEIC).
-
Increasing PHP memory limit
95% 失败
The error is about format support, not memory; increasing memory will not make ImageMagick recognize an unsupported format.