windows下安装ImageMagick扩展
最近项目中需要用到图片的一些特殊处理——比如:根据用户请求生成任意尺寸的图像。经过一些资料的查找,最终选用了php_imagick。利用 ImageMagick,你可以根据web应用程序的需要动态生成图片, 还可以对一个(或一组)图片进行改变大小、旋转、锐化、减色或增加特效等操作,并将操作的结果以相同格式或其它格式保存。本节我们就来介绍一下如何在 windows下安装php_imagick拓展。
1. 下载 Download ImageMagick
#下载页面:
http://www.imagemagick.org/script/binary-releases.php#windows
(这里比较难下载到老的版本,如果需要老的版本,可以在csdn下载,或者在我博客留言,我可以提供)
#直接下载:
http://www.imagemagick.org/download/binaries/ImageMagick-6.6.3-0-Q16-windows-dll.exe
(此路径已经不可用,可以从csdn下载,或者在我博客留言,我可以提供)
注意:如果php是5.2.x版本的,需要匹配到imageMagick 6.8.9版本,可以在csdn上进行下载。
2. 安装 Install ImageMagick
安装路径随意,我的安装是:
D:\WampServer\bin\ImageMagick-6.6.3-Q16
3. 测试 Testing the Installation
如果不加入环境变量的话,可以先下面方式测试:
Open the command prompt (Run->”CMD”->ENTER) and type in convert and press enter. You should see the help parameters of convert
1 |
cd D:\WampServer\bin\ImageMagick-6.6.3-Q16 # 回车 |
2 |
D:\WampServer\bin\ImageMagick-6.6.3-Q16>convert |
3 |
Version: ImageMagick 6.6.3-0 2010-07-01 Q16 http://www.imagemagick.org |
4 |
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC |
5 |
Features: OpenMP |
6 |
7 |
Usage: Magick [options ...] file [ [options ...] file ...] [options ...] file |
8 |
9 |
Image Settings: |
10 |
-adjoin join images into a single multi-image file |
11 |
-affine matrix affine transform matrix |
12 |
-alpha option activate, deactivate, reset, or set the alpha channel |
13 |
-antialias remove pixel-aliasing |
14 |
-authenticate password |
15 |
decipher image with this password |
16 |
-attenuate value lessen (or intensify) when adding noise to an image |
17 |
-background color background color |
18 |
-bias value add bias when convolving an image |
19 |
-black-point-compensation |
20 |
use black point compensation |
21 |
-blue-primary point chromaticity blue primary point |
22 |
-bordercolor color border color |
23 |
|
24.......
加入环境变量,方便以后使用(我的是WIndows7 系统):
我的电脑-》右键属性-》高级系统设置-》高级-》环境变量-》系统变量-》
-》找到Path, 点击编辑加入:
D:\WampServer\bin\ImageMagick-6.6.3-Q16;
加入完成之后,可以直接在命令行(CMD)使用convert了。
4. 下载DLL Downloading the php_Imagick.dll
Again the version problem, well if you are using PHP 5.2.x this is where you will get your dll.
我使用的是 (php5.2.9-2):php_imagick_dyn-Q16.dll
dyn = dynamic, st = static, q16 = 16 bit, q8= 8 bit. This should match your downloaded version of course. If you downloaded q16 dynamic library, your file will be php_imagick_dyn-Q16.dll
If you are using PHP 5.3.x, this is your location to download.
5. 编辑 PHP.ini
下载的php_imagick_dyn-Q16.dll需要改名为php_imagick.dll 然后保存到
D:\WampServer\bin\php\php5.2.9-2\ext\
然后编辑 PHP.ini
找到dll这里,加入下面的最后一行:
1 |
;extension=php_sybase_ct.dll |
2 |
;extension=php_tidy.dll |
3 |
;extension=php_xmlrpc.dll |
4 |
;extension=php_xsl.dll |
5 |
;extension=php_zip.dll |
6 |
extension=php_imagick.dll |
6. 重启Wamp
7. 通过查看phpinfo();
如果有imagick项应该成功了
8. 小测试
1 |
$im= newimagick( 'a.jpg'); |
2 |
// resize by 200 width and keep the ratio |
3 |
$im->thumbnailImage( 200, 0); |
4 |
// write to disk |
5 |
$im->writeImage( 'a_thumbnail.jpg'); |
好了,完成了。
windows下安装ImageMagick扩展的更多相关文章
- Windows下安装PHP扩展及资源下载地址(memcached为例)
官方下载的php安装包ext目录里以经包含了常用的php扩展,但某些情况下并不能满足我们项目需求,比如memcache扩展就不在官方的php安装包里.这时就需要我们自己去下载安装. 本文列出php官方 ...
- windows下安装MongoDB扩展和配置
windows下安装MongoDB扩展和配置 1.下载mongoDB扩展,根据当前php版本进行下载 地址如下:http://pecl.php.net/package/mongo 我本地php版本是 ...
- 在Windows下安装redis扩展和memcached扩展
一.php安装redis扩展 1.使用phpinfo()函数查看PHP的版本信息,这会决定扩展文件版本 2.根据PHP版本号,编译器版本号和CPU架构, 选择php_redis-2.2 ...
- 如何在windows下安装mongoDB扩展
安装环境 系统环境:Windows 10 64位 Apache版本:2.4.9 PHP版本:5.5.12 MongoDB版本:3.2.6 Wamp版本:wamp 2.5 86位 ...
- windows下安装ImageMagick
最近在开发过程中用到了ImageMagick,结合网上的教程做一下记录 安装的具体步骤可以参考http://blog.csdn.net/belen_xue/article/details/728962 ...
- windows下安装phpredis扩展
根据phpyinfo获取自己的php信息 x86,php5.6,TS,VC11 在pecl网站上找到对应的版本 5.6 Thread Safe (TS) x86 https://pecl.php.ne ...
- windows下安装pthreads扩展注意问题
1.php版本必须是ts版本 2.pthreads扩展下载地址 http://windows.php.net/downloads/pecl/releases/pthreads/ 3.把下载的扩展php ...
- windows 下安装 php-memcached 扩展
通过 phpinfo()观察 3 个参数,即 php 版本, ts/nts, vc6/vc9 根据上步中的参数,到http://pecl.php.net/ 下载匹配的 memcache.dll 再次观 ...
- windows下安装redis和php的redis扩展
1.redis简介 redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对更多,包括string(字符串).list(链表).set(集合).zset(s ...
随机推荐
- 30秒就能理解的JavaScript优秀代码
数组 arrayMax 返回数组中的最大值. 将Math.max()与扩展运算符 (...) 结合使用以获取数组中的最大值. const arrayMax = arr => Math.max(. ...
- Android学习——控件ListView的使用
一.ListView的简单用法 首先新建一个ListViewTest项目,并让Android Studio自动创建好活动.然后修改activity_main.xml中的代码,如下: <?xml ...
- Python 实现简单图片验证码登录
朋友说公司要在测试环境做接口测试,登录时需要传入正确的图片的验证码,本着懒省事的原则,推荐他把测试环境的图片验证码写死,我们公司也是这么做的^_^.劝说无果/(ㄒoㄒ)/~~,只能通过 OCR 技术来 ...
- Algorithms算法题<1.1>
1.1.27 二项分布.估计用一下代码计算binomial(100,50,0.25)将会产生的递归调用次数: public static double binomial(int N,int k,dou ...
- mvc cshtml 中赋值
@{ var str = ""; str = item.ApplyStatus == ? ? ? ? "申请驳回" : ""; } < ...
- [Shell] echo/输出 中引用命令
# 这样是错误的,是引用变量 echo "/Users/${whoami}/Desktop" >>> /Users//Desktop # 正确的写法应该是使用`` ...
- jq图片懒加载
jQuery图片延迟加载插件jQuery.lazyload,使用延迟加载在可提高网页下载速度.在某些情况下,它也能帮助减轻服务器负载. 使用方法 引用jquery和jquery.lazyload.js ...
- 面试官:为什么mysql不建议执行超过3表以上的多表关联查询?
概述 前段时间在跟其他公司DBA交流时谈到了mysql跟PG之间在多表关联查询上的一些区别,相比之下mysql只有一种表连接类型:嵌套循环连接(nested-loop),不支持排序-合并连接(sort ...
- WPF 创建用户控件并引用
项目源码地址:https://github.com/lizhiqiang0204/WpfControlLibrary.git 首先创建新项目->WPF用户控件库项目 在UserControl1. ...
- JS 用+1、-1填12()34()56()78()9=59
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...