安装之前必须安装lib库:
freetype-2.4.0.tar.gz
libtool-2.2.6a.tar.gz
jpegsrc.v6b.tar.gz
libpng-1.2.12.tar.gz
zlib-1.2.8.tar.gz
1,下载ImageMagick-6.7.1-6
复制代码 代码示例:
wget ftp://ftp.u-aizu.ac.jp/pub/graphics/image/ImageMagick/imagemagick.org/ImageMagick.tar.gz
[root@localhost zhangminsong]# ll
total 12380
-rw-r--r-- 1 root root 12656433 Aug 18 16:47 ImageMagick.tar.gz
2,解压
复制代码 代码示例:
[root@localhost zhangminsong]# tar -xzvf ImageMagick.tar.gz
3,编译安装
复制代码 代码示例:
[root@localhost zhangminsong]# cd ImageMagick-6.7.1-6
[root@localhost ImageMagick-6.7.1-6]# ./configure -prefix=/usr/local/imagemagick -enable-lzw -with-modules && make && make install
查看:
[root@localhost zhangminsong]# convert -version
Version: ImageMagick 6.7.1-6 2011-08-17 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP
测试:
[root@localhost ImageMagick-6.7.1-6]# pwd
/root/zhangminsong/ImageMagick-6.7.1-6
[root@localhost ImageMagick-6.7.1-6]# cd images/
[root@localhost images]# convert -sample 25%x25% wizard.jpg test.jpg
开始装imagick的PHP扩展
注意:安装imagick扩展时需要PHP >= 5.1.3,ImageMagick >= 6.2.4
1,获取imagick
复制代码 代码示例:
[root@localhost zhangminsong]# wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz
--2011-08-18 17:44:48-- http://pecl.php.net/get/imagick-3.1.0b1.tgz
Resolving pecl.php.net... 76.75.200.106
Connecting to pecl.php.net|76.75.200.106|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 93269 (91K) [application/octet-stream]
Saving to: `imagick-3.1.0b1.tgz'
100%[========================>] 93,269 55.6K/s in 1.6s
2011-08-18 17:44:51 (55.6 KB/s) - `imagick-3.1.0b1.tgz' saved [93269/93269]
解压imagick:
复制代码 代码示例:
[root@localhost zhangminsong]# tar zxvf imagick-3.1.0RC2.tgz
package.xml
imagick-3.1.0b1/examples/polygon.php
imagick-3.1.0b1/examples/captcha.php
imagick-3.1.0b1/examples/thumbnail.php
imagick-3.1.0b1/examples/watermark.php
imagick-3.1.0b1/config.m4
imagick-3.1.0b1/config.w32
imagick-3.1.0b1/CREDITS
imagick-3.1.0b1/imagick.c
imagick-3.1.0b1/imagick_class.c
imagick-3.1.0b1/imagickdraw_class.c
imagick-3.1.0b1/imagickpixel_class.c
imagick-3.1.0b1/imagickpixeliterator_class.c
imagick-3.1.0b1/imagick_helpers.c
imagick-3.1.0b1/imagick_file.c
imagick-3.1.0b1/php_imagick.h
imagick-3.1.0b1/php_imagick_defs.h
imagick-3.1.0b1/php_imagick_helpers.h
imagick-3.1.0b1/php_imagick_macros.h
imagick-3.1.0b1/php_imagick_shared.h
imagick-3.1.0b1/php_imagick_file.h
imagick-3.1.0b1/TODO
imagick-3.1.0b1/INSTALL
imagick-3.1.0b1/ChangeLog
phpize
复制代码 代码示例:
[root@localhost zhangminsong]# cd imagick-3.1.0RC2
[root@localhost imagick-3.1.0b1]# /opt/modules/php5.3.5/bin/phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
配置编译:
复制代码 代码示例:
[root@localhost zhangminsong]# ./configure --with-php-config=/opt/modules/php5.3.5/bin/php-config --with-imagick=/usr/local/imagemagick
*此处如果出错,请执行
ln -s /usr/local/imagemagick/include/ImageMagick-6 /usr/local/imagemagick/include/ImageMagick
[root@localhost zhangminsong]# make&&make install
*此处如果出错,请执行
export PKG_CONFIG_PATH=/********/imagemagick/lib/pkgconfig
重新编译。
编译成功后会在php 扩展目录生成imagick.so
这里的路径为:/opt/modules/php5.3.5/lib/php/extensions/no-debug-non-zts-20090626/
然后,在php.ini中添加:
extension="imagick.so"
重启php phpinfo()查看安装已完成。