centos5 yum安装imagemagick以及imagick扩展

(1)yum安装ImageMagick


yum install ImageMagick ImageMagick-devel


(2)测试是否安装成功


[root@localhost]# convert -version
Version: ImageMagick 6.2.8 05/07/12 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC


(3)安装imagick扩展


wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz
tar xzvf imagick-3.1.0RC2.tgz
cd imagick-3.1.0RC2
phpize
./configure
make
make install


(4)编辑php.ini文件,在文件末尾添加如下代码


extension=imagick.so


(5)重新启动apache服务器


service httpd restart


(6)imagick扩展使用范例


header('Content-type: image/png');
$files = '/var/test/test.png';
$image = new \Imagick($files);
$image->thumbnailImage(200, 100, true);
echo $image;

thumbnailImage()第三个参数表示Whether to force maximum values

imagick的类详见:http://www.php.net/manual/en/class.imagick.php

你可能感兴趣的:(PHP,linux,图片,yum,ImageMagick)