Some special handling of images is needed in recent projects-for example, to generate images of any size based on user requests. After some information to find, the final selection of Php_imagick. With ImageMagick, you can dynamically generate images based on the needs of your Web application, and you can resize, rotate, sharpen, subtract, or add effects to a (or a group of) images and save the results of the operation in the same format or other format. In this section we'll show you how to install Php_imagick extensions under Windows.
1. Download Download ImageMagick
#下载页面:
Http://www.imagemagick.org/script/binary-releases.php#windows
#直接下载:
Http://www.imagemagick.org/download/binaries/ImageMagick-6.6.3-0-Q16-windows-dll.exe
2. Installing the Install ImageMagick
Install the path arbitrarily, my installation is:
D:\WampServer\bin\ImageMagick-6.6.3-Q16
3. Test testing the installation
If you do not add an environment variable, you can test it in the following way:
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 |
7 |
Usage: Magick [options ...] file [ [options ...] file ...] [options ...] file |
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 |
-caption string assign a caption to an image
|
24
.......
Add environment variables to facilitate later use (my WIndows7 system):
My Computer-"right-click Properties-" Advanced system Settings-advanced-"Environment variables-" System Variables-"
-"Find path, click Edit to join:
D:\WampServer\bin\ImageMagick-6.6.3-Q16;
After joining, you can use convert directly at the command line (CMD).
4. Download dll downloading the Php_imagick.dll
Again The version problem, the well if you were using PHP 5.2.x this was where you would get the your DLL.
I used to be (php5.2.9-2): Php_imagick_dyn-q16.dll
dyn = dynamic, st = static, Q16 = 8 bit, q8= bit. This should match your downloaded version of course. If you downloaded q16 dynamic Library, your file'll be Php_imagick_dyn-q16.dll
If you were using PHP 5.3.x, this is the your location to download.
5. Edit PHP.ini
The downloaded Php_imagick_dyn-q16.dll is saved to
D:\WampServer\bin\php\php5.2.9-2\ext\
Then edit php.ini
Find the DLL here, add the following last line:
1 |
;extension=php_sybase_ct.dll |
2 |
;extension=php_tidy.dll |
3 |
;extension=php_xmlrpc.dll |
6 |
extension=php_imagick.dll |
6. Restart the WAMP7. By viewing phpinfo ();
If any of the Imagick items should be successful,
8. Small test
1 |
$im = new imagick( ‘a.jpg‘ ); |
2 |
// resize by 200 width and keep the ratio |
3 |
$im ->thumbnailImage( 200, 0); |
5 |
$im ->writeImage( ‘a_thumbnail.jpg‘ ); |
All right, it's done.
Install Imagick extensions under Windows (GO)