Getting imagemagick to run on windows 7 onwards with xampp/wampp or custom install

imagick is very useful library if you want to play with images on the server side, not bundled into php and a bit hard to install.

Following is a guideline collected from hit and trial and error where I tried to cover all the steps that are needed to get this libarary up and running on your system locally.

The php library

If you do not have this library you will get an error like

`Class ‘Imagick’ not found`

Get the dll for imagemagick php_imagick.dll from http://windows.php.net/downloads/pecl/releases/imagick/

In case if you are using php 7 as in my case, release 3.4.3 will do.

Download and extract the package to a temp dir. Next copy the php_imagik.dll file into your php/ext/ dir alongwith other extensions and all the CORE_RL_*dll files directly into php dir or a dir on php path where php can access it.

add the following line to php.ini file and restart apache

extension=php_imagick.dll

[note that in my case I was using yii framework where I also need to access the class as “new \Imagick ” , note the backslash ]

Installing the correct imageMagick dlls

At this point if you check phpinfo and scroll to the imagick section (only if you have completed the previous step it will appear in phpinfo) you will notice that there is no supported format.

Check the below line

Imagick compiled with ImageMagick version ImageMagick 6.9.3-7 Q16 x86 2016-03-27 http://www.imagemagick.org

This will tell you which imageMagick version will work best with your dll.

goto http://ftp.icm.edu.pl/packages/ImageMagick/binaries/ and download this exact version to avoid any kind of issues . similar versions may also work but there is no guarantee.

install the version and it will add to the path. Since I work in portable manner where I do not like to depend on the files in program files dir, I did the following additional steps (instead of modifying apache path) to include all the libs in apache itself

from the installed C:\Program Files (x86)\ImageMagick-6.9.3-Q16\modules dir, copy all the IM*dll and the filter*dll files and paste into apache/bin dir.

Restart apache once again and this time you will see that you have plenty of supported formats as seen in screenshot below.

 

Untitled

 

0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*