Unable to use Imagick class

心不动则不痛 提交于 2019-12-11 15:47:44

问题


I have installed imagick version:6.8.6-7 on my PC Operating system:Windows 7 32-bit

Now i want to use Imagick for my PHP project.I am using Wampserver which provides me PHP version:5.3.10.So i also installed a .dll file,made changes in php.ini,verified if the path is set with php_info() before using Imagick class and everything was ok.

Problem description: I wrote the script to test if i can use Imagick.Following is the script:

<?PHP
function alist ($array) {  //This function prints a text array as an html list.
$alist = "<ul>";
for ($i = 0; $i < sizeof($array); $i++) {
  $alist .= "<li>$array[$i]";
}
$alist .= "</ul>";
return $alist;
}
exec("convert -version", $out, $rcode); //Try to get ImageMagick "convert" program version number.
echo "Version return code is $rcode <br>"; //Print the return code: 0 if OK, nonzero if error.
echo alist($out); //Print the output of "convert -version"

if(class_exists("imagick") )
{
echo "Ready to use Imagick class";
}
else
{
echo "Cannot use Imagick class";
}
?>

Output

Version return code is 0

    Version: ImageMagick 6.8.6-7 2013-07-23 Q16 http://www.imagemagick.org
    Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
    Features: DPC OpenMP
    Delegates: bzlib djvu fftw fontconfig freetype jng jp2 jpeg lcms lzma openexr pango png ps tiff x xml zlib

Cannot use Imagick class

So even if the Version is properly displayed,i am not able to use Imagick class.How to fix this,help


回答1:


1: Install ImageMagick software http://www.imagemagick.org/script/binary-releases.php#windows

2: Download pecl-5.2-dev.zip (choose the version relevant to your PHP) from http://snaps.php.net/

3: Copy php_imagick.dll from the archive you've downloaded to your PHP extention folder.

4: Add the following line to php.ini (in the exntentions section): extension=php_imagick.dll

5: Restart your server




回答2:


cmorrissey's link for 2) seems to be broken but dlls can be downloaded here.

If you get a "CORE_RL_wand_.dll is missing" error, the solution is here. In my case, I had to take all the "CORE" dlls from the ImageMagic installation folder and copy them into the /php folder.



来源:https://stackoverflow.com/questions/17887372/unable-to-use-imagick-class

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