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

时间:2022-05-11 09:00:41

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

我很困惑如何在Bitnami的WAMP栈上安装/启用Imagick…我看着php。我和ini没有任何关于ImageMagick的东西,尽管有一个专门用于ImageMagick的文件夹叫做ImageMagick:o。

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

当我尝试在我的web应用程序中做一些事情时,我得到了这个错误:

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.

来自Bitnami有知识和专业技能的Bitnami's WAMP栈的任何人,请带来解决方案?这有点荒谬,Bitnami声称它支持ImageMagick对PHP 7.1的支持,但只是在名称中添加了一个ImageMagick的文件夹,但是没有关于如何启用它的实际解释。我花了无数个小时在这上面。我有所有正确的.dll文件,并在php中添加它们作为扩展。ini文件,重新启动WAMP,仍然没有。

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().

它是否有一个绝对的文件路径,本地文件路径,有和没有引号,以及后面和前面的斜杠,并且测试了,没有引号…每一个可能性。我不确定为什么当我回传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.

必须添加一个名为:MAGICK_HOME的变量,其值指向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.)

并且必须将相同的目录添加到路径中(并将其移到php 1之上)。但我不确定这是否需要。只是为了以防万一。

2 个解决方案

#1


0  

You need to install ImageMagick first. Please download ImageMagick from https://www.imagemagick.org/script/binary-releases.php according to your OS.

首先需要安装ImageMagick。请根据您的操作系统从https://www.imagemagick.org/script/bin -releases.php下载ImageMagick。

Then edit php.ini and add new line (replace your installation path)

然后编辑php。ini和添加新行(替换您的安装路径)

extension="C:\Bitnami\wampstack-5.6.6-0\php\ext\php_imagick.dll"

Restart WAMP and its done.

重新启动WAMP和它的工作。

#2


0  

Figured it out AFTER HOURS OF FRUSTRATION AND BREAKS. Sorry.

经过数小时的挫折和休息后,我终于明白了。对不起。

Anyways I had to add SYSTEM VARIABLES (in addition to adding the dll extension in php.ini).

无论如何,我必须添加系统变量(除了在php.ini中添加dll扩展)。

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

必须添加一个名为:MAGICK_HOME的变量,其值指向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.)

并且必须将相同的目录添加到路径中(并将其移到php 1之上)。但我不确定这是否需要。只是为了以防万一。

#1


0  

You need to install ImageMagick first. Please download ImageMagick from https://www.imagemagick.org/script/binary-releases.php according to your OS.

首先需要安装ImageMagick。请根据您的操作系统从https://www.imagemagick.org/script/bin -releases.php下载ImageMagick。

Then edit php.ini and add new line (replace your installation path)

然后编辑php。ini和添加新行(替换您的安装路径)

extension="C:\Bitnami\wampstack-5.6.6-0\php\ext\php_imagick.dll"

Restart WAMP and its done.

重新启动WAMP和它的工作。

#2


0  

Figured it out AFTER HOURS OF FRUSTRATION AND BREAKS. Sorry.

经过数小时的挫折和休息后,我终于明白了。对不起。

Anyways I had to add SYSTEM VARIABLES (in addition to adding the dll extension in php.ini).

无论如何,我必须添加系统变量(除了在php.ini中添加dll扩展)。

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

必须添加一个名为:MAGICK_HOME的变量,其值指向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.)

并且必须将相同的目录添加到路径中(并将其移到php 1之上)。但我不确定这是否需要。只是为了以防万一。