php ImageMagick 此图像格式无解码委托
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30005612/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ImageMagick No decode delegate for this image format
提问by SmootQ
I work under windows and wamp server.
我在 windows 和 wamp 服务器下工作。
this is my PHP code with Imagick
这是我使用 Imagick 的 PHP 代码
$imagick = new Imagick($_SERVER['DOCUMENT_ROOT'] . '/' . $this->_name);
where $_SERVER['DOCUMENT_ROOT'].'/'.$this->_name
displays :
其中$_SERVER['DOCUMENT_ROOT'].'/'.$this->_name
显示:
D:/Sources/my_project/public/media/2/9/1/05201502/55450e1b6543a05201502_9.PNG
D:/Sources/my_project/public/media/2/9/1/05201502/55450e1b6543a05201502_9.PNG
I checked that image and it does exist in the folder.
我检查了该图像,它确实存在于文件夹中。
But Imagick throws an exception :
但 Imagick 抛出一个异常:
Uncaught exception 'ImagickException' with message 'no decode delegate for this image format `D:/Sources/my_project/public/media/2/9/1/05201502/55450b10d8ea705201502_9.PNG' @ error/constitute.c/ReadImage/555' in D:\Sources\my_project\library\project\Image.php on line 225
未捕获的异常 'ImagickException' 带有消息 '此图像格式没有解码委托 'D:/Sources/my_project/public/media/2/9/1/05201502/55450b10d8ea705201502_9.PNG' @ error/constitute.c/ReadImage/555'在 D:\Sources\my_project\library\project\Image.php 中的第 225 行
I looked for a solution, but didn't find any, how can I fix this?? thank you
我寻找了解决方案,但没有找到任何解决方案,我该如何解决??谢谢你
Update:This is the result when I type convert -version
in the command line :
更新:这是我convert -version
在命令行中输入的结果:
Version: ImageMagick 6.8.8-4 Q16 x86 2014-01-29 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo freetype jbig jng jp2 jpeg lcms lqr pangocairo \
png ps rsv g tiff webp xml zlib
update
更新
This is the phpinfo of imagick.
这是 imagick 的 phpinfo。
ImageMagick number of supported formats: 0
ImageMagick supported formats: no value
ImageMagick 支持的格式数量:0
ImageMagick 支持的格式:无值
采纳答案by Kalle Volkov
Seems that your ImageMagick PHP module does not support anyimage formats.
似乎您的 ImageMagick PHP 模块不支持任何图像格式。
Try to find other ImageMagick installation or install PHP from the scratch.
尝试寻找其他 ImageMagick 安装或从头开始安装 PHP。
Also - seems that there is already question/answerin SO about that
另外 - 似乎已经有关于这个的问题/答案
回答by Kurt Pfeifle
You should run
你应该跑
convert -version
and report the output. On my system it is
并报告输出。在我的系统上是
Version: ImageMagick 6.9.0-0 Q16 x86_64 2014-12-06 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib gvc jbig \
jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps \
rsvg tiff webp wmf x xml zlib
Does your output include png
as one of the built-in 'delegates'?
您的输出是否包括png
作为内置“委托”之一?
If not, update your installation, or build from current sources.
如果没有,请更新您的安装,或从当前源构建。
回答by Andrey Radomanov
Finally I found solution for my windows openserver/nginx/php-fpm installation:
最后我找到了我的 windows openserver/nginx/php-fpm 安装的解决方案:
- Download latest php_imagick distributive for your version of PHP from http://windows.php.net/downloads/pecl/releases/imagick/(e.g. php_imagick-3.4.3-7.1-ts-vc14-x64.zip)
- Extract only php_imagick.dll from this archive to your "php/ext" folder.
- Run phpinfo() and check value at line "Imagick compiled with ImageMagick version" (mine was: "ImageMagick 6.9.3-7 Q16 x64 ...").
- Now go to http://windows.php.net/downloads/pecl/deps/and download correct version of Imagick-*.zip file (mine was: ImageMagick-6.9.3-7-vc14-x64.zip).
- Extact this archive and copy all *.dll files from "/bin" folder to yout "php/ext" folder (about 145 files).
- Restart server and check phpinfo(). ImageMagick now supports about 230+ formats.
- 从http://windows.php.net/downloads/pecl/releases/imagick/(例如 php_imagick-3.4.3-7.1-ts-vc14-x64.zip)为您的 PHP 版本下载最新的 php_imagick 发行版
- 仅从该存档中提取 php_imagick.dll 到您的“php/ext”文件夹。
- 运行 phpinfo() 并检查“用 ImageMagick 版本编译的 Imagick”行的值(我的是:“ImageMagick 6.9.3-7 Q16 x64 ...”)。
- 现在转到http://windows.php.net/downloads/pecl/deps/并下载正确版本的 Imagick-*.zip 文件(我的是:ImageMagick-6.9.3-7-vc14-x64.zip)。
- 解压此存档并将所有 *.dll 文件从“/bin”文件夹复制到“php/ext”文件夹(大约 145 个文件)。
- 重新启动服务器并检查 phpinfo()。ImageMagick 现在支持大约 230 多种格式。
Sometimes phpinfo() displays that imagick supports all formats, but php scripts are not respond - in this case double check that you download correct version of Imagick-*.zip for your installations. (ts/nts, VC11/VC14, x64/x86)
有时 phpinfo() 显示 imagick 支持所有格式,但 php 脚本没有响应 - 在这种情况下,请仔细检查您是否为安装下载了正确版本的 Imagick-*.zip。(ts/nts, VC11/VC14, x64/x86)