- 安装ImageMagick
yum install ImageMagick
2.查看是否安装成功
convert -version
3.安装php-imagick扩展
(1).下载imagick扩展 官网
(2) 源码编译
1.wget http://pecl.php.net/get/imagick-3.4.3.tgz
2.tar -zxvf imagick-3.4.3.tgz
3.cd imagick-3.4.3
4../configure
报错:
error: not found. Please provide a path to MagickWand-config or Wand-config program.
解决:
yum install ImageMagick-devel
5.make and make install
编译成功
(3)复制imagick.so到extension_dir目录下,在 php.ini中添加extension=imagick.so;
7. cp imagick.so /etc
8. vi /etc/php.ini
9.service php-fpm restart
(4)查看phpinfo();
4.测试代码生成缩略图
<?php
ini_set('display_errors',1);
header('Content-type: image/jpeg');
$image = new Imagick('1.jpg');
$image->thumbnailImage(100,0);
echo $image;
?>
如图