【问题标题】:PHP Fatal error: Uncaught exception 'ImagickException' with message 'no decode delegate for this image formatPHP 致命错误:未捕获的异常 'ImagickException' 带有消息 'no decode delegate for this image format
【发布时间】:2014-04-12 22:28:05
【问题描述】:

我正在使用 AWS EC2 Bitnami AMI:bitnami-lampstack-5.4.11-1-linux-ubuntu-12.04.1-x86_64-ebs (ami-aadf4cc3)

我有一个 php 文件:

<?php 
    $im = new imagick();
    $im->readImageBlob(file_get_contents("http://s3.amazonaws.com/bucket/file.jpg"));
?>

这给了我以下错误:

PHP Fatal error:  Uncaught exception 'ImagickException' with message 'no decode delegate for this image format `' @ error/blob.c/BlobToImage/361' in /opt/bitnami/apache2/htdocs/index.php:3
Stack trace:
#0 /opt/bitnami/apache2/htdocs/index.php(3): Imagick->readimageblob('??????JFIF?????...')
#1 {main}
  thrown in /opt/bitnami/apache2/htdocs/index.php on line 3

我使用以下步骤安装了 imagick:

1) wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz
    2) tar -zxvf imagick-3.1.0RC2.tgz
    3) cd imagick-3.1.0RC2
    4) phpize
    5) ./configure
    6) make
    7) make install

到目前为止,我已经尝试过:

1) file_get_contents is returning the image file and it is a confirmed jpeg
2) using convert directly from the command line --> it works
3) imagick-3.0.1 on this AMI and it won't install because of compiler errors
4) imagick-3.0.1 on the previous bitnami AMI (bitnami-lampstack-5.3.10-2-linux-ubuntu-12.04-x86_64-ebs (ami-8c4c96e5)) and it gives the same ImagickException error (no decode delegate)
5) Using a PNG file which gives me the same error

Convert -list configure 给我 DELEGATES bzlib freetype jpeg jng png tiff zlib

【问题讨论】:

    标签: php amazon-web-services amazon-ec2 imagick bitnami


    【解决方案1】:

    解决办法:

    更新/opt/bitnami/scripts/setenv.sh如下

    MAGICKCODERMODULE_PATH="/usr/lib/ImageMagick-6.6.9/modules-Q16/coders"

    那么

    `/opt/bitnami/ctlscript.sh restart apache`
    

    【讨论】:

    • 选择您自己的答案作为正确的答案,以帮助其他人寻找类似的解决方案。
    • 这是MAGICK_CODER_MODULE_PATH,而不是MAGICKCODERMODULE_PATH
    猜你喜欢
    • 2016-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多