Php_imagick is a php extension that can be used by PHP to invoke the ImageMagick feature. Using this extension allows PHP to have the same functionality as ImageMagick, now let's look at how PHP installs Imagick under Linux.
Description:
PHP installation directory:/USR/LOCAL/PHP5
php.ini configuration file path:/usr/local/php5/etc/php.ini
Nginx installation directory:/usr/local/nginx
Nginx Web site root:/usr/local/nginx/html
1, install compilation tool
Yum install wget make gcc gcc-c++ gtk+-devel zlib-devel openss L openssl-devel pcre-devel kernel keyutils patch perl
2, installing ImageMagick
System operation Dimension www.osyunwei.com warm reminder: qihang01 original content copyright, reprint please specify the source and the original link
cd/usr/local/src# into the package storage directory
wgethttp:// www.imagemagick.org/download/ImageMagick.tar.gz# download ImageMagick
Tar zxvf imagemagick.tar.gz# extract
CD imagemagick-6.7.9-3# into the installation directory
./configure--prefix=/usr/local/imagemagick# configuration
make# compiling
make install# installation
Export pkg_config_path=/usr/local/imagemagick/lib/pkgconfig/#设置环境变量
3, install Imagick
CD/USR/LOCAL/SRC
wgethttp://pecl.php.net/get/imagick-3.0.1.tgz# download Imagick
Tar zxvf imagick-3.0.1.tgz
cd imagick-3.0.1
/usr /local/php5/bin/phpize# phpize Build Configure configuration file
./configure--with-php-config=/usr/local/php5/bin/php-config-- With-imagick=/usr/local/imagemagick# Configure
make# compile
Make install# installation
Note: An error occurred during the installation process, typically due to the lack of a compilation toolkit, you can follow the prompts to install the appropriate toolkit by referring to the first step
after the installation is complete , the following interface appears, remembering the path below, which will be followed by the
Installing shared extensions:/usr/local/php5/lib/php/extensions/ no-debug-non-zts-20090626/#imagick模块路径
4, configure PHP support Imagick
vi/usr/local/php5/etc/php.ini# edit configuration file, On the last line, add the following
extension= "imagick.so"
5, Test
vi/usr/local/nginx/html/phpinfo.php# Edit, enter the following code
< PHP
Phpinfo ();
wq! #保存退出
vi/usr/local/nginx/html/imagick.php# Edit, enter the following code
<? PHP
Header (' Content-type: Image/jpeg ');
$image = new Imagick (' www.osyunwei.com.jpg ');
//If 0 is provided as a width or height parameter,
//aspect ratio is maintained
$image->thumbnailimage (3 00, 225);
Echo $image;
?