Recent projects require some special handling of pictures-for example, to generate images of any size based on user requests. After some data search, the final selection of Php_imagick. With ImageMagick, you can dynamically generate pictures based on the needs of your Web application, and you can resize, rotate, sharpen, subtractive, or add special effects to one (or a group) of pictures and save the results of the operation in the same format or in other formats. In this section we'll explain 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. Install Install ImageMagick
Installation path random, my installation is:
D:\WAMPSERVER\BIN\IMAGEMAGICK-6.6.3-Q16 3. Test Testing the installation
If you don't add environment variables, you can test them in the following ways:
Open the command prompt (run-> "CMD"->enter) and type in convert and press ENTER. You should to the help parameters of convert
CD D:\WampServer\bin\ImageMagick-6.6.3-Q16 # Enter D:\wampserver\bin\imagemagick-6.6.3-q16>convert Version: ImageMagick 6.6.3-0 2010-07-01 Q16 http://www.imagemagick.org copyright:copyright (C) 1999-2010 ImageMagick Studio LLC Fe ATURES:OPENMP Usage:magick [Options ...] file [[Options ...] file ...] [Options ...] File Image Settings:-adjoin join images into a single multi-image file-affine matrix affine tran Sform matrix-alpha option Activate, deactivate, reset, or set the Alpha Channel-antialias remove pi Xel-aliasing-authenticate Password decipher image with this password-attenuate value less En (or intensify) when adding noise to a image-background color background color-bias value add bias WH En convolving an image-black-point-compensation with black point compensation-blue-primary poi NT chromaticity Blue primary point-bordercolor color border color
-caption string assign a caption to "an image ..........
Add environment variables to facilitate later use (my WIndows7 system):
My Computer-right key properties-Advanced system Settings-advanced-"Environment variables-" System Variables-"
-"Find path, click Edit to add:"
D:\WampServer\bin\ImageMagick-6.6.3-Q16;
After the join is complete, you can use convert directly on the command line (CMD). 4. Download dll downloading the Php_imagick.dll
Again The version problem, if you are a using PHP 5.2.x this are where you'll get your DLL.
I am using (php5.2.9-2): Php_imagick_dyn-q16.dll
dyn = dynamic, st = static, Q16 = bit, q8= 8 bit. This should match your downloaded version of course. If you downloaded q16 dynamic Library, your file would bephp_imagick_dyn-q16.dll
If you are are using PHP 5.3.x , this is your location to download. 5. Editor 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 DLL here, join the last line below:
, Extension=php_sybase_ct.dll,
Extension=php_tidy.dll,
extension=php_xmlrpc.dll,
extension=php_ Xsl.dll
; Extension=php_zip.dll
Extension=php_imagick.dll
6. Restart Wamp
7. By viewing Phpinfo ();
If a Imagick item should be successful 8. Small Test
$im = new Imagick (' a.jpg ');
Resize
by width and keep the ratio $im->thumbnailimage (0);
Write to Disk
$im->writeimage (' a_thumbnail.jpg ');
Well, it's done.