已安装Imagemagick但未找到Imagick类

时间:2014-02-21 01:33:04

标签: php imagemagick

当我跑步时:

<?php exec("convert -version",$out,$returnval); print_r($out[0]); ?>

我明白了:

Version: ImageMagick 6.5.4-7 2012-05-07 Q16 OpenMP http://www.imagemagick.org

但是当我跑步时:

$image = new Imagick($tiffImage);

我明白了:

Fatal error: Class 'Imagick' not found in /home/content/...

3 个答案:

答案 0 :(得分:1)

您尚未将imagemagic php扩展名(.so或.dll)文件安装到正确的位置。尝试阅读本页:

http://www.php.net/manual/en/imagick.installation.php

在linux中你需要它.so和windows它是dll。

答案 1 :(得分:1)

由于共享托管,我无法安装imagemagick php扩展,但我发现了这个解决方法:

<?php
try {
$cmd = "full-path-to/input1.tiff full-path-to/input2.png"; 
exec("/usr/local/bin/convert $cmd");
}
catch(Exception $e) {
die('Error when creating a file: ' . $e->getMessage());
}

?>

答案 2 :(得分:1)

在debian中,你安装了php5-imagick,你必须重新启动apache2服务器