下面我们来看一篇关于centos 6.5 安装ImageMagick 和 php扩展的教程,希望这篇教程能够帮助到各位朋友,有兴趣的可以进来看看。
安装:ImageMagick
代码如下 |
|
wget http://www.imagemagick.org/download/ImageMagick-7.0.1-5.tar.gz
tar -xzvf ImageMagick-7.0.1-5.tar.gz
./configure --prefix=/usr/local/imagemagick
make
make install
|
安装ImageMagick的php扩展:
代码如下 |
|
yum install ImageMagick-devel -y
ln -s -f /usr/local/imagemagick/include/ImageMagick-7 /usr/local/imagemagick/include/ImageMagick
wget http://pecl.php.net/get/imagick-3.1.0RC1.tgz
tar -xzvf imagick-3.1.0RC1
phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-imagick=/usr/local/imagemagick/include/ImageMagick
make
make install
|
php.ini配置
代码如下 |
|
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"
extension=imagick.so
|
附Discuz配置路径:/usr/local/ImageMagick/bin
如果是在Discuz程序中要使用ImageMagick处理图片水印/缩放等,请在php.ini文件中允许exec函数的运行,否则将不工作。
找到disable_functions,去除exec字段。
友情提醒:允许php的exec函数运行可能会导致安全问题,请根据需要自行取舍本功能。
配置时遇到个奇葩的问题,/usr/local/ImageMagick/bin在php5.5下居然填不进去。。。直接去 pre_common_setting 搜索
imageimpath 填入 ,discuz 后台更新缓存,完美。。。。bmp也可以压缩咯 呵呵