Imagick: PNG support available in command line, but not available in PHP

。_饼干妹妹 提交于 2019-12-13 18:09:55

问题


I found that I did not have PNG support in my Imagick installation, so I installed libpng. Now I can see that PNG format is supported when I run a command

convert -list format

And conversion from PNG to JPG works fine from command line:

convert a.png b.jpg

But when I try to read a PNG file in PHP:

    $src = new \Imagick();
    $src->readImageBlob( file_get_contents($file) ); // reading PNG format

-it gives me Error 500 ("...no decode delegate for this image format")

Also when I run phpinfo() - I see no PNG in list of Imagick's supported file formats. There are many others, but no PNG.

I tried to I resintall PHP Imagick driver and then restart apache - still no succeess.

PS: I have PHP 5.4 @ CentOS


回答1:


According to the installation requirements. "The amount of formats supported is by Imagick is entirely dependent upon the amount of formats supported by your ImageMagick installation." I imagine you’ll need to rebuild the PHP imagemagick extension. See here: http://php.net/manual/en/imagick.installation.php




回答2:


Problem solved.

I used a guide for Imagick installation @CentOS from the link below, reinstalled everything exactly as it said there, and it helped - http://www.directadmin.com/forum/showthread.php?t=44449&page=1



来源:https://stackoverflow.com/questions/13968345/imagick-png-support-available-in-command-line-but-not-available-in-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!