php 如何使 ImageMagick Imagick 类可用?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1578547/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:09:41  来源:igfitidea点击:

How to make ImageMagick Imagick class available?

phpimagemagick

提问by lalalow

This is a really amateur question but I've installed ImageMagickfrom the ports on my FreeBSD.

这是一个非常业余的问题,但我已经从 FreeBSD 上的端口安装了ImageMagick

However when I use

但是当我使用

$image = new Imagick($filename);

I get:

我得到:

Fatal error: Class 'Imagick' not found in /usr/local/www/test.php on line 1

致命错误:在第 1 行的 /usr/local/www/test.php 中找不到“Imagick”类

How do I make this class accessible to the scripts?

如何让脚本可以访问这个类?

回答by Ewan Todd

pecl install imagick

pecl 安装 imagick

See the manual.

请参阅手册

回答by etheros

You installed the ImageMagick suite itself, which does not provide any interface to PHP. You also need to install the PECL Imagickextension.

您安装了 ImageMagick 套件本身,它不提供任何 PHP 接口。您还需要安装PECL Imagick扩展。

FreeBSD has a portavailable for this - graphics/pecl-imagick.

FreeBSD 有一个可用的端口- graphics/pecl-imagick.

回答by Jon Kirkman

You will also need to get/build the accompanying PHP library that interfaces with Image Magick. Then add it to your php.ini with something like:

您还需要获取/构建与 Image Magick 接口的随附 PHP 库。然后将其添加到您的 php.ini 中,如下所示:

extension=php5-imagick.so

There is also a OS X / Darwin port available here.

还有一个OS X /达尔文端口可用在这里

回答by Pouma

apt-get install imagemagick && apt-get install php-imagick

(Ubuntu)

(Ubuntu)