windows7下安装php的imagick和imagemagick扩展教程
最近的PHP项目中,需要用到切图和缩图的效果,在linux测试服务器上很轻松的就安装好php imagick扩展。但是在本地windows开发环境,安装过程遇到好多问题,在此与大家分享。
1. 下载 ImageMagick
下载地址:http://imagemagick.org/script/binary-releases.php#windows
下载最新版本,ImageMagick-6.8.6-9-Q16-x86-dll.exe
2. 安装 ImageMagick
安装 ImageMagick 到 PC 上。安装路径不能出现空格,否则无法使用。安装时,一点选中把执行路径添加到 path 上,否则你就得手动去添加 path 路径了。
3. 测试安装
打开windows 命令行窗口(win+r -> “cmd” -> Enter),输入convert,回车。会出现convert的帮助文档,如果没有出现,说明没有安装成功,或没有把安装目录添加到环境变量 path 中。
添加到环境变量,如我的 ImageMagick 安装目录是 c:/imagemagick。
添加过程:
我的电脑 -> 右键点击 -> 高级系统设置 -> 高级 -> 环境变量 -> 系统变量 -> path -> 选择并编辑 -> 把你的安装目录,添加到其中
4. 下载 php扩展 php_imagick.dll
php5.4.x or php5.5.x 下载地址 http://www.peewit.fr/imagick/
dyn = dynamic, st = static, q16 = 16 bit, q8= 8 bit.
以上标识,同你下载的ImageMagick下载标识相同,本人用的是q16
5. 把dll文件重命名为php_imagick.dll,并放到php 扩展文件目录 php/ext 中。
6. 在 php.ini 配置文件中添加,extension=php_imagick.dll。
7. 重启电脑,只重启apache不管用的情况下,重启下PC。因为扩展底层使用的是imageMagic软件,所以软件重启电脑,重新加载软件,并刷新path路径。
8. 重启后,打开 phpinfo页面,查看,扩展已经安装成功。如果还未安装成功,极有可能imagemagick软件版本过高,请选择更低一级的版本安装。
9. PHP测试代码。
<?php $im = new imagick( 'a.jpg' ); // resize by 200 width and keep the ratio $im->thumbnailImage( 200, 0); // write to disk $im->writeImage( 'a_thumbnail.jpg' );
10. 查看手册,学习API
相关扩展学习手册地址 http://uk3.php.net/manual/zh/book.imagick.php 手册中包含大量易用实例。
这里还有查看命令行参数的文档 http://www.imagemagick.org/Usage/

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

In this chapter, we are going to learn the following topics related to routing ?

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

Validator can be created by adding the following two lines in the controller.
