php imagemagick 配置
2016-07-29 00:00
447 查看
最近需要在项目中用到ImageMagick来对上传的图片做多图处理,在配置上遇到些问题,Windows7与Ubuntu上均不可能一次完美安装,不过在Linux下调来调去的比较有意思,所以在Ubuntu下查了不少东西,记录了其中几个比较关键的问题。
1. 先装ImageMagick
下载ImageMagick http://www.imagemagick.org/ wget ftp://ftp.u-aizu.ac.jp/pub/graphics/image/ImageMagick/imagemagick.org/ImageMagick-6.6.5-10.tar.gz tar -xzvf ImageMagick-6.6.5-10.tar.gz
./configure -prefix=/usr/local/ImageMagick -disable-openmp(没加在ubuntu下重启php可能会出错)
make && make install
2. 再装Imagick
wget http://pecl.php.net/get/imagick-3.0.1.tgz tar -xzvf imagick-3.0.1.tgz
cd imagick-3.0.1
phpize
//phpize是一个shell脚本,主要是用来进行编译环境的准备,执行以后会生成一些新的文件,为配置、编译及安装作好准备
使用./configure --help 查看配置选项
./configure --with-php-config=/usr/local/php5/bin/php-config --with-imagick=/usr/local/ImageMagick
In the step, we should edit the file imagick-3.1.0RC2/config.m4 line number 55.
Make changes like this, from
if test -r $WAND_DIR/include/ImageMagick/wand/MagickWand.h;
to
if test -r $WAND_DIR/include/ImageMagick-6/wand/MagickWand.h;
Note this difference made in the imagick version number. After that try the conventional installation procedures
cd imagick-3.1.0RC2
phpize
./configure
make
make install
php配置
extension=imagick.so
如此搞定。
测试如下:
<?php
$im = new imagick( 'b.jpg' );
// resize by 200 width and keep the ratio
$im->thumbnailImage( 100, 0);
// write to disk
$im->writeImage( 'b_thumbnail.jpg' );
?>
特此记录,也希望对看到的同学有所帮助。
相关链接:
http://stackoverflow.com/questions/17836893/imagemagick-pecl-issue-cannot-locate-header-file-magickwand-h http://hi.baidu.com/q1225904052/item/05b92fe58c56392a86d9de4a http://blog.csdn.net/swingpyzf/article/details/8923899 http://www.imagemagick.org/script/install-source.php#unix
1. 先装ImageMagick
下载ImageMagick http://www.imagemagick.org/ wget ftp://ftp.u-aizu.ac.jp/pub/graphics/image/ImageMagick/imagemagick.org/ImageMagick-6.6.5-10.tar.gz tar -xzvf ImageMagick-6.6.5-10.tar.gz
./configure -prefix=/usr/local/ImageMagick -disable-openmp(没加在ubuntu下重启php可能会出错)
make && make install
2. 再装Imagick
wget http://pecl.php.net/get/imagick-3.0.1.tgz tar -xzvf imagick-3.0.1.tgz
cd imagick-3.0.1
phpize
//phpize是一个shell脚本,主要是用来进行编译环境的准备,执行以后会生成一些新的文件,为配置、编译及安装作好准备
使用./configure --help 查看配置选项
./configure --with-php-config=/usr/local/php5/bin/php-config --with-imagick=/usr/local/ImageMagick
In the step, we should edit the file imagick-3.1.0RC2/config.m4 line number 55.
Make changes like this, from
if test -r $WAND_DIR/include/ImageMagick/wand/MagickWand.h;
to
if test -r $WAND_DIR/include/ImageMagick-6/wand/MagickWand.h;
Note this difference made in the imagick version number. After that try the conventional installation procedures
cd imagick-3.1.0RC2
phpize
./configure
make
make install
php配置
extension=imagick.so
如此搞定。
测试如下:
<?php
$im = new imagick( 'b.jpg' );
// resize by 200 width and keep the ratio
$im->thumbnailImage( 100, 0);
// write to disk
$im->writeImage( 'b_thumbnail.jpg' );
?>
特此记录,也希望对看到的同学有所帮助。
相关链接:
http://stackoverflow.com/questions/17836893/imagemagick-pecl-issue-cannot-locate-header-file-magickwand-h http://hi.baidu.com/q1225904052/item/05b92fe58c56392a86d9de4a http://blog.csdn.net/swingpyzf/article/details/8923899 http://www.imagemagick.org/script/install-source.php#unix
相关文章推荐
- PHP邮件发送类(修改网上代码,亲测可用)
- win下php开发的痛点
- tp基础补充
- PHP的魔法方法__set() __get()
- ThinkPHP框架基础 创建控制器
- PHP设计模式理解
- [thinkphp5 学习笔记] model类型
- php 配置curl_init支持
- jetty小技巧:plugin方式下,如何调整启动的端口号;jetty独立部署时,如何修改上下文contextPath
- ThinkPHP控制器
- php小记
- PHP实现多文件上传
- Thinkphp3.2+PHPQRCode 二维码生成示例
- 【中文分词-全文搜索】Ubuntu 16.04 Mysql和PHP 配置 Sphinx-for-chinese 及Sphinx的排序筛选分页基本操作
- yii框架中sphinx单条件搜索
- ThinkPHP 基础
- thinkphp介绍及访问方式
- PHP之MVC项目实战
- PHP之MVC学习
- thinkphp5 tablib标签库自定义