如何在Bitnami的wamp-stack PHP v7.1.4上安装和使用ImageMagick / Imagick

I'm so confused on how to install/enable the use of Imagick on Bitnami's WAMP Stack... I look into php.ini and I see NOTHING about ImageMagick even though there's literally a folder dedicated to ImageMagick called imagemagick :o

When trying to do stuff in my web app, I get this error:

An uncaught Exception was encountered

Type: Error

Message: Class 'imagick' not found

This is my code:

    // Initialize new ImageMagick object
    $im = new imagick($dir_path.'/'.$original_img_filename);

    // Convert to PNG
    $im->setImageFormat('png');

    // Write image onto server
    $im->writeImage($filename.'.png');
    $im->clear();
    $im->destroy();

    // Delete original downloaded image file
    $is_deleted = unlink($dir_path.'/'.$original_img_filename);

Can anyone from Bitnami with knowledge and expertise in Bitnami's WAMP stack please bring to light the solution? It's kind of ridiculous that Bitnami claims it supports ImageMagick for PHP 7.1 but just adds a folder with ImageMagick in the name but with no actual explanation on how to enable it. I've spent countless hours on this. I have all the correct .dll files and added them as extensions in the php.ini file, restarted WAMP and still nothing.

Did it with an absolute file path, local file path, with and without quotes as well as with the back and forward slashes, and tested with and without quotes... EVERY SINGLE POSSIBILITY. I'm not sure exactly why it isn't showing up when I echo out phpinfo().

Thanks.

edit: Figured it out. I had to add SYSTEM VARIABLES.

Had to add a variable named: MAGICK_HOME with the value pointing to the root directory of ImageMagick.

And had to add the same directory to the PATH (and moved it up so that it is above the php one. But im not sure if that is needed. just did it in case.)

查看全部
dongshanjin8947
dongshanjin8947
2017/06/24 12:40
  • imagick
  • php
  • wamp
  • imagemagick
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

2个回复