ImageMagick缺少解码代理

时间:2012-05-22 20:14:58

标签: php imagemagick imagick

我最近转移到MediaTemple并按照他们的知识库文章here安装了ImageMagick和IMagick。

没有错误,phpinfo()显示模块已正确安装。

当我尝试通过PHP在JPG图像上使用IM时出现此错误

Uncaught exception 'ImagickException' with message 'no decode delegate for this image format 
/home/149263/domains/wer.com/html/images/pictures/post/tmp/original/' @ error/constitute.c/ReadImage/544' in /nfs/c10/h04/mnt/149263/domains/wer.com/html/application/controllers/post.php:301
Stack trace:
#0 /nfs/c10/h04/mnt/149263/domains/wer.com/html/application/controllers/post.php(301): Imagick->__construct('/home/149263/do...')
#1 [internal function]: Post->filter('punch')
#2 /nfs/c10/h04/mnt/149263/domains/wer.com/html/system/core/CodeIgniter.php(359): call_user_func_array(Array, Array)
#3 /nfs/c10/h04/mnt/149263/domains/wer.com/html/index.php(217): require_once('/nfs/c10/h04/mn...')
#4 {main} thrown in /nfs/c10/h04/mnt/149263/domains/wer.com/html/application/controllers/post.php on line 301

但是convert -list configure会返回

DELEGATES     bzlib djvu fontconfig freetype gvc jpeg jp2 lcms openexr png rsvg tiff wmf x11 xml zlib

identify -list format返回

JPEG* JPEG      rw-   Joint Photographic Experts Group JFIF format (62)
JPG* JPEG      rw-   Joint Photographic Experts Group JFIF format

所以看起来安装是正确的。

ImageMagick 6.7.7-0 2012-05-22 
imagick module version  3.1.0RC1

有关如何解决此问题的任何建议吗?

2 个答案:

答案 0 :(得分:9)

在Ubuntu 12.04上安装最新版本(撰写本文时为6.8.4-6)ImageMagick,这是一个快速而又肮脏的。

首先删除之前通过apt-get安装的旧版本:

sudo apt-get remove imagemagick

然后更新apt-get并安装一些支持包:

sudo apt-get update
sudo apt-get install libperl-dev gcc libjpeg-dev libbz2-dev libtiff4-dev libwmf-dev libz-dev libpng12-dev libx11-dev libxt-dev libxext-dev libxml2-dev libfreetype6-dev liblcms1-dev libexif-dev perl libjasper-dev libltdl3-dev graphviz pkg-config

使用wget从ImageMagick.org获取源代码。

下载源代码后,将其解压缩:

tar -xzf ImageMagick.tar.gz

现在配置并制作:

cd ImageMagick-6.8.4-6
./configure
sudo make
sudo make install

避免出现如下错误:

convert: error while loading shared libraries: libMagickCore.so.2: cannot open shared object file: No such file or directory

将以下行添加到~/.bashrc

export LD_LIBRARY_PATH=/usr/local/lib

更新:如果仍然出现上述错误,请尝试运行ldconfig:

sudo ldconfig

您可以使用以下方式确认安装和可用格式:

identify -list format

答案 1 :(得分:0)

您是否尝试使用Imagemagick通过exec()运行一些代码来查看Imagemagick或Imagick是否存在问题?