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 ...
随机推荐
- Redux入门
Redux入门 本文转载自:众成翻译 译者:miaoYu 链接:http://www.zcfy.cc/article/4728 原文:https://bumbu.github.io/simple-re ...
- jQuery中样式和属性模块简单分析
1.行内样式操作 目标:扩展框架实现行内样式的增删改查 1.1 创建 css 方法 目标:实现单个样式或者多个样式的操作 1.1.1 css方法 -获取样式 注意:使用 style 属性只能获取行内样 ...
- 读书笔记7-浪潮之巅(part2)
浪潮之巅 ——成功的公司各有各的绝招,而失败的公司倒有不少的共同之处 奔腾的芯(Intel) 前身:在处理器性能还很平庸的年代,站在科技前沿的计算机公司都是集中在工作站级处理器领域的,而同IBM.DE ...
- Shell Notes
查找: find: 实时查找,精确,速度慢,支持正则 find 查找路径 查找标准 查到后处理动作 查找路径默认当前目录,查找标准默认路径下所有文件,动作默认打印到屏幕 匹配标准: -name 'fi ...
- java servlet 3.0文件上传
在以前,处理文件上传是一个很痛苦的事情,大都借助于开源的上传组件,诸如commons fileupload等.现在好了,很方便,便捷到比那些组件都方便至极.以前的HTML端上传表单不用改变什么,还是一 ...
- SQLite Tips
附加数据库 Attach database filename as database_name; 主数据库默认为 "Main", 在使用Attach命令时, 不能将database ...
- ES5:深入解析如何js定义类或对象。
1.原始方式 var oCar = new Object; oCar.color = "blue"; oCar.showColor = function(){alert(this ...
- 转载:移动端自适应:flexible.js可伸缩布局使用
阿里团队开源的一个库.flexible.js,主要是实现在各种不同的移动端界面实现一稿搞定所有的设备兼容自适应问题. 实现方法: 通过JS来调整html的字体大小,而在页面中的制作稿则统一使用rem这 ...
- nginx日志按日期自动切割脚本
#!/bin/bash #nginx日志切割脚本 #author:setevn #设置日志文件存放目录 logs_path="/usr/local/nginx/logs/" #设置 ...
- python与图灵机器人交互(WXPY版本)
开发者账号:wujunfeng , 开发者key:官网申请 #!/usr/bin/env python#-*- coding:utf-8 -*- @Author : wujf @Time:2018/ ...