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 = new imagick( '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 ...
随机推荐
- 读《Android电视机(机顶盒)初次开发的一些经验分享》后的笔记
原文: http://blog.csdn.net/tanghongchang123/article/details/52982818 一.基本命令: 1.adb connect [ip] 2. adb ...
- Singleton pattern的线程安全问题
original post from here方法一:同步机制关键词public class Singleton { 2 //利用静态变量来记录Singleton的唯一实例 3 private sta ...
- easyui的datetimebox时间格式化详解
今天公司让用easyui的datetimebox组件,而且还要让格式化成大家通用的那种,网上搜了很多,但差不多都是复制黏贴的,最后请教了下螃蟹. 感谢螃蟹抽空给做了个例子,现在拿出来和大家分享下,效果 ...
- 3D特征:关于HFM和HBB
1.HBB 三维绑定框 (1): 要用到HBB,定义还不太清楚,来自于 VALVE Developer Community (https://developer.valvesoftware.co ...
- 路飞学城Python-Day100
Django项目之图书馆项目 1.项目架构 2.表结构设计 from django.db import models # Create your models here. #作者详情表 class A ...
- Linux下清空文件的几种方法
$ : > filename $ > filename $ echo "" > filename $ echo > filename $ cat /dev/ ...
- UML类图解析
上面是UML的语法. 在画类图的时候,理清类和类之间的关系是重点.类的关系有泛化(Generalization).实现(Realization).依赖(Dependency)和关联(Associati ...
- Selenium 安装与配置及webdriver的API与定位元素
1. selenium安装命令行 C:\Users\wu>cd /d E:\soft\python3.6\Scripts E:\soft\python3.6\Scripts>pip3 in ...
- Blender软件导出的obj数据格式文件内容解读
[cube.obj] # Blender v2.78 (sub 0) OBJ File: '' # www.blender.org mtllib cube.mtl #这里是引用了一个外部材质文件cub ...
- [2018.8.12]模拟赛B组
T1 打表出奇迹,发现结论为\(E(a_n)=n+1\)即可. #include <iostream> #include <cstdio> #include <cctyp ...