Windows7 installation of PHP Imagick and ImageMagick extended tutorials _php Tips

Source: Internet
Author: User
Tags imagemagick

In the recent PHP project, you need to use the Chettu and thumbnail effect, the Linux test server is very easy to install the PHP imagick extension. However, in the local Windows development environment, the installation process encountered a lot of problems, here to share with you.

1. Download ImageMagick
Download Address: http://imagemagick.org/script/binary-releases.php

Download the latest version, Imagemagick-6.8.6-9-q16-x86-dll.exe

2. Install ImageMagick
Install the ImageMagick to the PC. The installation path cannot be used unless there is a space. At the time of installation, add the execution path to the path, or you will have to add the path path manually.

3. Test Installation
Open the Windows Command Line window (win+r-> "cmd"-> Enter), type convert, enter. The Help document for convert appears, if it does not appear, either without a successful installation or without adding the installation directory to the environment variable path.

Add to environment variables, such as my ImageMagick installation directory is C:/imagemagick.

To add a procedure:
My Computer-> right-click-> Advanced system Settings-> advanced-> environment variable-> system variable-> path-> Select and edit-> add your installation directory to it

4. Download PHP extensions Php_imagick.dll


php5.4.x or php5.5.x download address http://www.peewit.fr/imagick/

dyn = dynamic, st = static, Q16 = bit, q8= 8 bit.

The above logo, and you download the ImageMagick download logo is the same, I use the Q16

5. Rename the DLL file to Php_imagick.dll and place it in the PHP extension file directory php/ext.

6. Add in php.ini configuration file, Extension=php_imagick.dll.

7. Restart the computer, reboot the PC only if it is not used. Because the Imagemagic software is used at the bottom of the extension, the software restarts the computer, reloads the software, and refreshes the path.

8. After the reboot, open the Phpinfo page, see, the extension has been installed successfully. If the installation has not been successful, it is highly likely that the ImageMagick software version is too high, please choose a lower level version of the installation.

9. PHP test Code.

<?php
$im = new Imagick (' a.jpg ');
Resize
by width and keep the ratio $im->thumbnailimage (0);
Write to Disk
$im->writeimage (' a_thumbnail.jpg ');

10. View the manual, learning API

The relevant extended Learning manual address http://uk3.php.net/manual/zh/book.imagick.php manual contains a number of easy-to-use examples.

There's also a document that looks at the command-line arguments http://www.imagemagick.org/Usage/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.