Home >Backend Development >PHP Tutorial >Tutorial on installing PHP imagick and imagemagick extension under Windows 7_PHP Tutorial

Tutorial on installing PHP imagick and imagemagick extension under Windows 7_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:26:32761browse

In a recent PHP project, the effects of image cutting and thumbnailing need to be used. The php imagick extension can be easily installed on the Linux test server. However, in the local windows development environment, many problems were encountered during the installation process, which I would like to share with you.

1. Download ImageMagick
Download address: http://imagemagick.org/script/binary-releases.php#windows

Download the latest version, ImageMagick-6.8.6-9-Q16-x86-dll.exe

2. Install ImageMagick
Install ImageMagick on your PC. There must be no spaces in the installation path, otherwise it cannot be used. When installing, click to add the execution path to the path, otherwise you have to add the path manually.

3. Test installation
Open the windows command line window (win+r -> "cmd" -> Enter), enter convert, and press Enter. The convert help document will appear. If it does not appear, it means that the installation was not successful, or the installation directory was not added to the environment variable path.

Add to environment variables, for example, my ImageMagick installation directory is c:/imagemagick.

Add process:
My Computer-> Right-click-> Advanced System Settings-> Advanced-> Environment Variables-> System Variables-> path -> Select and edit-> Add your installation directory to it

4. Download php extension php_imagick.dll


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

dyn = dynamic, st = static, q16 = 16 bit, q8= 8 bit.

The above logo is the same as the ImageMagick download logo you downloaded. I use q16

5. Rename the dll file to php_imagick.dll and put it in the php extension file directory php/ext.

6. Add extension=php_imagick.dll in the php.ini configuration file.

7. Restart the computer. If restarting apache does not work, restart the PC. Because the bottom layer of the extension uses imageMagic software, the software restarts the computer, reloads the software, and refreshes the path.

8. After restarting, open the phpinfo page and check that the extension has been successfully installed. If the installation has not been successful, it is very likely that the imagemagick software version is too high. Please choose a lower version to install.

9. PHP test code.

<&#63;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. View the manual and learn the API

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

There is also documentation for viewing command line parameters here http://www.imagemagick.org/Usage/

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/824630.htmlTechArticleIn a recent PHP project, you need to use the effects of cutting and thumbnailing, which is very easy on the Linux test server Just install the php imagick extension. But in the local windows development environment, the installation process...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn