Installing ImageMagick on Windows and Using with PHP – Imagick
As most of your know ImageMagick is like the photoshop on your console demand. Best with their explanation.
ImageMagick® is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
It is very powerful and supports all platforms with tons of different languages and implementations. Because my hosting solutions did not suppot it (many of them dont do as well) I always used awesome GD library to process images on my projects. Well now my hosting does support and I am going to use it so I needed to install it to my development environment which is windows. I am going to install and use Imagick also because using IM from native PHP is much more faster than using it from console via exec.
Well first of all ImageMagick on windows with PHP is a really pain in the ass, if you have the commitment and time go for it otherwise use it from console. Here are the steps and todo's to install for PHP 5.2.x, ( I dont know if it works with PHP 5.3.x or below, you will need to test for yourself. I am a happy camper for now ).
UPDATE
Just to make things clear, all the PHP dll files (librarires) are 32 bit, so if your system is 64 bit and you will still need to download and operate 32 bit ImageMagick, Apache, etc.
1 Download ImageMagick
Go to http://imagemagick.org/script/binary-releases.php#windows to download the latest version, which is ImageMagick-6.5.4-2-Q16-windows-dll.exe
Now the beauty, static versions are suppose to work with every platform but they act really funny so you should download a dynamic version. If you system/pc supports go for 16 bit Q16. The difference is explained on the link very well.
Now in my case, the latest version did not work so I had to go through old versions and ImageMagick-6.4.2-7-Q16-windows-dll version worked like charm for me. My system is Windows XP SP2, 32 Bit, Intel Centrino 1.76GHZ. You can download the older versions from here.
I suggest you to download and try the latest one, complete all steps, if it doesnt work try with a lower version and so on.
2 Install ImageMagick
Install the IM on a path like C:\imagemagick\ with no spaces and simple location. Do not go for c:\program files\etc
Do not forget to click on the "Add to system path" checkbox. You can ignore the rest of the checkboxes
3 Testing the Installation
Open the command prompt (Run->"CMD"->ENTER) and type in convert and press enter. You should see the help parameters of convert. If so go to step 4.
if it says its failed or unknown function or type in a parameter to convert ( which is a default function in Windows XP to convert HDD from FAT32 to NTFS or vice varsa ) you need to add path to environment by yourself.
My Computer -> Right Click -> Properties -> Advanced (Tab) -> Environment Variables (at the bottom) -> System Variables (Section) -> Scroll to Find "Path" -> Select it and click Edit -> Add your installation directory to there.
4 Downloading the php_Imagick.dll
Again the version problem, well if you are using PHP 5.2.x this is where you will get your dll.
dyn = dynamic, st = static, q16 = 16 bit, q8= 8 bit. This should match your downloaded version of course. If you downloaded q16 dynamic library, your file will be php_imagick_dyn-Q16.dll
If you are using PHP 5.3.x, this is your location to download.
5 Find and Place the dll in your extension folder
Rename the downloaded dll to php_imagick.dll for easy usage and place it under your extension folder. It is usually php/ext/. Go to Step 6.
If it is not, then you can find it in your php.ini file with the extension_dir param.
; Directory in which the loadable extensions (modules) reside.
extension_dir = "Something something"
6 Edit PHP.ini
Uncomment if it exists or add if it doesnt exist this line
extension=php_imagick.dll
7 Restart
This is the important part, I spent good half an hour trying to make it work.. grrrr.. You need to restart your PC to libraries take effect.
If you do not restart and start your apache you will see an error like. So please do restart your PC.
Unable to find CORE_RL_Wand.dll something something.
8 Start Apache and check
Start your apache, and check with the phpinfo() , if you see imagick library and its values thats it you are set. go to step 9.
If not you have picked up the wrong dll file for PHP. Browse through the directory and try another dlls, if they dont work try to lower your ImageMagick installation version. Dont give up, it will work.
9 Test with some code
Put a nice big picture named a.jpg along side with your test.php script, run the test and check the directory to see a_thumnail.jpg. Here is the script, simple and fast
<? $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 Manual, Learning and Playing Around
To use it from php all you need is PHP functions and manual including some examples as well.
If you want to go further and mess around here is the command line ( exec() ) parameters, manuals and examples
Finally
So this is it, I hope you get it to work at the first trial now and drop a comment if you have any useful information or experience any error, we will try to help you out.
No related posts.















July 17th, 2009 - 08:24
Hi
THank you very much for this tutorial.
I have following all the steps and restarted the machine.. everything working fine excepts the last one (9).
am getting the following error
Fatal error: Class ‘imagick’ not found
please help
thanks in advance
July 17th, 2009 - 08:31
@Unnikrishnan
do your phpinfo() display the imagick class as described in step 8?
if not then check your php.ini for your dll directory and make sure you are using the correct dll file for your php version.
if yes use uppercase I in the definition.
new ImagickJuly 19th, 2009 - 18:50
Is there a version for PHP 5.3 that is compiled with VC6 which I believe is required for Apache..???
Thanks in advance
July 21st, 2009 - 12:37
@RandyJohnson
Yes I also gave the php 5.3 required dll link.
I believe all the libraries are complied with VC (which version does not matter) if you are having runtime problems make sure you have the .net framework installed (at least 2.0)
Addition to that you can download the source files from
http://pecl.php.net/package/imagick/
and compile one for yourself.
July 29th, 2009 - 06:23
You definetevly need a VC6-compiled version of php_imagick.dll for
apache-binaries. VC9′s are for IIS-environments.
The choice of “thread-safe” vs. “non-thread-safe” is not important on
windows-systems, as its a multi-thread-system, and could handle “nts”.
But VC6-compiled versions of php_xxx.dll’s are a MUST, or your apache won’t start.
July 29th, 2009 - 11:08
Thanks for the clarification
August 20th, 2009 - 17:27
Anyone have any idea where to get the VC6 php_imagick.dll for PHP 5.3.0? All I see in the above supplied site is for VC9, which obviously causes my Apache-based install to shout at me saying wrong VC build.
August 29th, 2009 - 03:33
+1 on the request for a VC6 build. Could someone please upload one? Thanks.
September 19th, 2009 - 18:59
I will upload my version for PHP 5.2.0, hope its ok for you guys.
November 25th, 2009 - 11:10
Thanks man. This was really helpful!
December 13th, 2009 - 17:32
Thanks for the tip of restarting.. save me a lot of time
December 13th, 2009 - 17:35
yw i wished someone told me as well before trying it
January 15th, 2010 - 15:37
Thanks for the howto. Work perfectly.
PHP Version 5.2.6
ImageMagick-6.5.9-0-Q16-windows-dll
php_imagick_dyn-Q16.dll
January 17th, 2010 - 20:30
Thanks a lot for this. It surely saved me a lot of time/trouble.
It works perfectly for me with the following software:
Windows 7
ISS 7.5
PHP 5.3.1
ImageMagick-6.5.9-0-Q16-windows-dll.exe
imagick-2.3.0-dev/vc9_nts/php_imagick.dll
June 20th, 2012 - 11:48
Hi!
I am wondering how to use ImageMagick with PHP.
I have done all these stuffs and successfully installed it. I have successfully tried converting PDFs to images using the command prompt, but when I tried to execute some simple PHP codes e.g.:
“$command2=’convert hello.pdf hello.jpg’;
if(exec($command2)){
echo ‘yes’;
}
else{
echo ‘no’;
}”
but unfortunately failed to convert by using such codes.
I need some help regarding this:(
Thanks in advance:)
God bless:)
June 21st, 2012 - 17:24
Hi ana,
when you do in the command prompt you have the path defined in windows shell so when you say convert, it translates into c:\windows\etcetcetc\convert.exe
in php comman shell you don’t have that conversion, so you will have to provide full path to the executable.
January 23rd, 2010 - 02:54
Can’t install on a server with plesk php 5.2.6
January 23rd, 2010 - 05:12
I am guessing your Plesk running server is Linux or Unix based but the post is about windows OS. I am guessing plesk have installers like cpanel as well to install imagick kindof stuff.
February 15th, 2010 - 13:26
thanks man, restarting the computer fixed my prob.
March 4th, 2010 - 12:24
i m getting problem at installation time.. windows prompting error
unable to execute file: ppm
shellExecuteEx : failed code 2
can u help me out
April 8th, 2010 - 02:03
i’m getting error (warning message box) like this:
“PHP startup: imagick: unable to initialize module
Module compiled with module API=20060613
PHP compiled with module API=20090626
The options need to match”
i’m using PHP 5.3.0 and ImageMagick 6.6.1.0 and php dll php_imagick 6.6.1.0..
can u help me??
November 13th, 2012 - 20:54
I am guessing you are using a VC6 dll, you need VC9 dlls for php 5.3.X
April 16th, 2010 - 16:41
I got the same error as @Treda
November 13th, 2012 - 20:54
Please see above.
April 16th, 2010 - 20:29
This instructions worked well, but I had to use php 5.2 instead of 5.3. I could not get it to work with 5.3 for the life of me.
April 26th, 2010 - 10:56
try this out
http://www.knowledge-transfers.com/archives/677
May 18th, 2010 - 12:39
Just to say … thanks a TON
May 24th, 2010 - 07:50
http://www.knowledge-transfers.com/it/installing-imagemagick-on-windows-setup-imagick-on-php
May 29th, 2010 - 22:06
Thanks for clear instructions. Possibly the first set of instructions I’ve been able to follow without some trial and error entering play at some point.
Managed to get the whole lot installed and running faultlessly in one attempt.
Excellent!
May 30th, 2010 - 22:39
You should install ImageMagick.exe then restart your computer before trying to install the php extension. Still trying to make it work with php 5.3.2
August 6th, 2010 - 23:16
it started working somehow after i added enviroment variable MAGICK_HOME to C:/imagemagick (or whats your installation dir)
August 6th, 2010 - 23:19
forget it, i was wrong. still doesn’t work.
August 7th, 2010 - 01:57
Be sure to make them backslashes \ for windows environments.. for apache and php ini settings they become forwards / slashes
July 18th, 2010 - 19:36
Awesome tutorial. Very well done. Got it to work just fine. Thank you!
August 19th, 2010 - 20:22
For anyone getting this error:
PHP Startup: Unable to load dynamic library ‘C:/programms/Wamp/bin/php/php5.3.0/ext/php_imagick.dll’
Please check if Windows XP prevents the access to this file. To check this simply use the windows explorer click on the php_imagick.dll -> right click. Down on the opened window you have to click on a buttons named”approve”or something like this. (Sorry. I use a non-english windows version)
Hope this will save you silly time I spend on this issue
September 8th, 2010 - 13:24
really its awesome… and excellent tutorial step by step
its very useful and save my time…. Thanks a lot
September 23rd, 2010 - 13:07
thanks, perfect!
October 4th, 2010 - 16:16
I am having trouble finding the right dll for php 5.2.5. I tried the static 16 bit dll and it does not show up in the phpinfo page. I tried some others from different folders from where you download the dlls and none of them are working.
ImageMagick 6.6.4 is installed and working correctly. We installed using the multithreaded static build so I believe that I have the correct dll.
Any help would be much appreciated.
October 13th, 2010 - 09:36
Did you try 8bit static?
October 13th, 2010 - 14:01
I did not try that one. I did not manually build ImageMagick so I was assuming that since it did not say that it was 8 bit that it would be 16 bit. I also had ImageMagick installed on a different server and it took the static 16 bit dll just fine, and we installed the same version of ImageMagick on the other server. Would this have anything to do with what version of php we’re running?
October 13th, 2010 - 15:00
Well bit wise operations depends on your CPU so it changes on every machines (assuming they are not identical) so you should know the exact version to find static or dynamic then the bit version..
I had a page to determine which version your system needs but I can not remember it at the moment. Try searching for it.
October 13th, 2010 - 16:40
We had used the multithreaded static build for ImageMagick. The server is running IIS 6.0. I would think that those would take 16 bit.
October 13th, 2010 - 18:07
I was at work co couldnt focus on the content of your comments. As I said in the post, latest version did not work for me either. Try to lower your Image Magic version to the lower levels like mine . You should definitely try out the version I stated and download the same .dll file I have linked to..
Imagick on Windows is a pain in the rear end. I wasted enough time to figure out the versions and compatibility, by trial and error and posted on the net just so I or someone else wont go through the same trouble.
Hope that will help. Good luck
October 13th, 2010 - 09:15
Hi, I stop in point 7. I have error “Unable to find CORE_RL_Wand.dll something something.” still. Please help me.
October 13th, 2010 - 09:35
Hey Marti,
You need to restart your system
October 13th, 2010 - 12:40
I restart system few times. Everything looks good but I still heave the same error. PATH is OK.
October 13th, 2010 - 18:00
run phpinfo and check if your dll is compatible.
October 14th, 2010 - 07:36
I have PHP ver. 5.2.9 and php_imagick_dyn-Q16.dll
October 25th, 2010 - 17:22
new problem for me now that I finally got everything installed and showing up on the phpinfo page, when I am trying to run imagick I get a php fastcgi error.
The FastCGI Handler was unable to process the request.
Error Details:
* The FastCGI process exited unexpectedly
* Error Number: -2147467259 (0×80004005).
* Error Description: Unspecified error
HTTP Error 500 – Server Error.
Internet Information Services (IIS)
What is the Imagick dll doing that is causing this to error out?
thanks
October 25th, 2010 - 17:58
Anna I or people I know never tried to install imagick on IIS with fastcgi.. always linux and default php handlers.. looks like something is not compatible, try with dso or modphp handlers
October 25th, 2010 - 18:21
Image Magick is installed but but it is php that is installed with fastcgi. That was the only way that we saw to install php without manually compiling it. What fastcgi is supposed to do is handle any files with the extension of .php. Other things that I have seen mention something about time outs being too short but that does not seem to be the error that I am getting.
Are you suggesting that we reinstall php using dso or modphp or is there something else that we could try?
October 25th, 2010 - 18:41
I dont know how php functions with IIS.. you should use php with apache.
I suggest install lite old version of xampp (apache php mysql compilation for windows) for php 5.2 then try to run your imagick
December 21st, 2010 - 09:21
cheers! it’s works!
January 9th, 2011 - 00:22
Link to php_imagick_ts.dll for VC6 PHP:
http://www.sk89q.com/2010/03/vc6-windows-binaries-for-imagick-2-3-0/
My website in Brazil:
http://www.sistemabasico.com.br/2010/11/15/extensao-imagick-php-windows/
January 25th, 2011 - 08:16
The newest Windows binaries you can download from my website http://dev.freshsite.pl/imagick.html. All dynamic, Q8.
cheers
tk1
March 28th, 2011 - 14:16
God bless you all for those instructions !
April 16th, 2011 - 11:59
Thanks so much… you rock
June 14th, 2011 - 14:17
Thanks a lot!!! I spent half a day to find a solution… Tried the latest versions and some other combinations and always got Error 500 “Premature end of script headers”…
For Windows XP, PHP 5.3.5, Apache 1.3/2.2 this combination worked: ImageMagick-6.5.7-10-Q16-windows-dll.exe + http://valokuva…./php53/imagick-2.3.0-dev/vc9_zts/php_imagick.dll
June 26th, 2011 - 13:10
Your process error show………Image magick not install
July 12th, 2011 - 21:20
Running Windows 7 64-bit, PHP 5.3.4 and Apache 2.2…this works. Just one thing…do not use the 64-bit ImageMagick installation (x64) because it doesn’t seem to work with the .dll for PHP 5.3.4. I had to use the 32-bit version of the installation to get it to work with php_imagick.dll.
August 14th, 2011 - 18:35
I was running around in circles and it was your last comment that got it up and running for me. The 64-bit version definitely doesn’t seem to work.
I did have a weird issue though. When I tested to see if it was working the script supplied timed out on me.
Timed out:
$im = new imagick( ‘a.jpg’ );
Worked:
$im = new imagick( ‘C:\path\to\image\a.jpg’ );
I am not sure if you had the same problem or maybe I’ve set some thing up wrong.
August 15th, 2011 - 11:03
All the DLL files compiled for Imagick are 32bit. If you are on the 64 bit systems, you still need to install 32 bit Image Magick.
August 27th, 2011 - 09:27
Hello, I am using windows 7, xampp 1.7.3. I have followed all the steps you explained above. I had restarted the machine. While starting the localhost I get the httpd.exe system error as “php5.dll file is missing. ”
And one warning message “Unable to load the dynamic library ..\ext/php_imagick.dll the specified module could not be found” i had tried the 6.3 and newer versions for the imagemagick installer. still the same problem i am getting. please suggest the solution.
January 25th, 2012 - 23:15
I had the same problem at first. I’m using windows 7 as well and xampp 2.5. I have used ImageMagick-6.4.2-7-Q16-windows-dll and php_imagick_dyn-Q16.dll and it works. Probably you use wrong mix of ImageMagick nad ImageMagick for php.
October 13th, 2011 - 13:37
I got it work with full path like Murray, but I need to do pdf thumbnail, so I tried below:
exec(“im_convert \”{C:\xampp\htdocs\_ImageMagick_test\tips.pdf}[0]\” -colorspace RGB -geometry 200 \”C:\xampp\htdocs\_ImageMagick_test01.gif\”");
exec(“im_convert \”{tips.pdf}[0]\” -colorspace RGB -geometry 200 \”001.gif\”");
Anyone can suggest ?
October 25th, 2011 - 08:47
Great man.I tried lot of times to install imagick.But yours is exactly what I want.Thanks for your tutorial.It saves my time.
November 9th, 2011 - 16:09
Thanks. The restart tip did the job.
November 22nd, 2011 - 08:43
hello,
i am getting a warning and i don’t have any idea about it..please help me out ..
i am using php 5.3.5 and i have tried different dll of imagick
I am getting a alert box on restarting Apache:
PHP Startup: imagick: unable to intialize module
Module compiled with module API=20060213
PHP compiled with module API= 20090626
These options need to match
November 13th, 2012 - 20:59
I assume you are using 64bit. You need to install everything 32bit.
January 25th, 2012 - 23:08
Thanks for this tutorial. All works great.
March 14th, 2012 - 20:25
If you are getting this error:
imagick: Unable to initialize module
Module compiled with build ID=API20090626,TS,VC9
PHP compiled with build ID=API20090626,TS,VC6
These options need to match
That means the .dll file you are using is the wrong version. The links provided in step 4 above only have the VC9 version. You can get the VC6 version here: http://www.sk89q.com/2010/03/vc6-windows-binaries-for-imagick-2-3-0/
March 18th, 2012 - 22:23
I got ImageMagick working under XAMPP, with this write-up:
http://jeremycook.ca/2010/06/06/installing-imagick-under-apache-on-windows/
I just left a comment there that outlines what I used. Just wanted to direct people to it, since it worked for me!
March 27th, 2012 - 14:55
works like a charm
thank you very much !
April 3rd, 2012 - 12:41
Hi All,
I am new for Imagick. I have PHP 5.3.6 version on my PC(Windows XP Professional 2002- SP3 Dual Core Processor). I have installed “ImageMagick-6.7.6-3-Q16-windows-static.exe” file on my system and perform successfully step 3. After that install the “php_imagick.dll” file under the [C:\PHP\ext]. Finally restart my pc and and execute command PHP -v from the cmd prompt. It gives me following errors :
1).This application has failed to start because CORE_RL_wand.dll was not found,. Re-installing the application may fix this problem.
2).PHPStartup: Unable to load library ‘c:\php\ext\php_imagick.dll’ – The specified module could not be found.
what is this “CORE_RL_wand.dll” file where should I put it?
Please any one help.
Thanks in advance.
May 17th, 2012 - 16:48
Excellent tutotial!!! Thanks a lot!!!
June 20th, 2012 - 11:50
Hi!
I am wondering how to use ImageMagick with PHP.
I have done all these stuffs and successfully installed it. I have successfully tried converting PDFs to images using the command prompt, but when I tried to execute some simple PHP codes e.g.:
“$command2=’convert hello.pdf hello.jpg’;
if(exec($command2)){
echo ‘yes’;
}
else{
echo ‘no’;
}”
but unfortunately failed to convert by using such codes.
I need some help regarding this:(
Thanks in advance:)
God bless:)
June 23rd, 2012 - 21:07
Hi all,
I am getting some error:
1>the procedure entry point php_checkuid_ex could not be located in dynamic link library php5ts.dll
2> PHP startyp: unable to load dynamic library. “path to dll” the specified procedure could not be found.
I am using wamp… php 5.4.3 VC9
August 26th, 2012 - 14:03
Hello! I installed ! and i got some problem!
My code is
try {
$im = new imagick( ‘Image_179.jpg’ );
$im->thumbnailImage( 200, 0);
$im->writeImage( ‘mda_thumbnail.jpg’ );
} catch (ImagickException $e) {
echo $e->getMessage();
}
and i have message: unable to open image `ocs\NNNNNN\Image_179.jpg’: No such file or directory @ error/blob.c/OpenBlob/2641
this is path D:\xampp\htdocs\NNNNNN\Image_179.jpg
but it says that it is not exist! help please why it cant to find my file?
September 14th, 2012 - 18:08
A wonderful tutorial….I want to know, that i am using a system in php where user upload pdf files at the time of uploading i want to make a thumbnail of first page of uploaded pdf so that i can display that image in front..how to do it with imagemagic
-thanx in advance
November 13th, 2012 - 21:02
Imagick and PDF.. well good luck
September 19th, 2012 - 17:36
Hi, W7 64bit, xampp-win32-1.7.7-VC9 (PHP 5.3.8), ImageMagick-6.6.9-9-Q16-windows-dll, php_imagick.dll (vc9_zts). I finally suceeded but spent one day on it. Before I changed the ImageMagick version I got that CORE_RL_wand.dll error above. Hope it helps.
November 13th, 2012 - 20:51
Glad you got it working Ferdinand,
Your setup should be an example to most of the 5.3 and Windows 7 64bit users out there.
October 15th, 2012 - 16:31
hey, thank you for this tutorial. pls is it possible to install imagick to php 5.4? the php 5.3 dll extension doesn’t work for me.
November 13th, 2012 - 21:04
Unless someone compiles new dll for the php 5.4 branch, not going to be possible..
October 28th, 2012 - 10:22
Hello,
I know this is an old post, but I thought I would give it a try. I am getting the “Fatal error: Class ‘imagick’ not found ” message.
Here is what I’ve done:
1. Downloaded the ImageMagick-6.8.0-3-Q16-windows-x64-dll.exe file
2. Installed into C:\imagemagick\ and checked the “Add to system path” checkbox.
3. Opened the command prompt and typed in “convert” and pressed enter. I did see the help parameters of convert.
4. Downloaded both, and tried both, dll files from here: http://www.sk89q.com/2010/03/vc6-windows-binaries-for-imagick-2-3-0/
5. Renamed the downloaded dll to php_imagick.dll and placed it under the extension folder c:/wamp/bin/php/php5.3.13/ext
6. Added “extension=php_imagick.dll” to the php.ini file
7. Restarted my computer and WAMP server.
8. Ran phpinfo() and I did see these settings:
Apache Environment:
PATH C:\imagemagick;
Additional Modules:
Environment :
Path C:\imagemagick;
PHP Variables:
_SERVER["MAGICK_HOME"] C:/imagemagick
_SERVER["PATH"] C:\imagemagick;
I did not however see a specific section on Imagemagick.
I have also (as per Imagemagick website instructions) done this:
“If you have any problems, install the Visual C++ 2010 Redistributable Package (x86) or Visual C++ 2010 Redistributable Package (x64). 64-bit Windows requires both packages (x86 & x64).”
I have also tried the VC9 dlls.
My System:
Win 7
WAMP 2.2
PHP 5.3.13
ImageMagick 6.8.0
Like I said, I know this is an old post, but this is by far the best instructions that I have found anywhere on the internet…so I’m hoping you find this post and are able to point me in the right direction.
Thanks very much for your time
~FOX~
November 13th, 2012 - 20:49
Hi Andrew,
You need VC9 dlls and need to see the Imagick lib details in the phpinfo() output.
Bare in mind you are using 64bit imagick while your dll might be 32bit.
November 9th, 2012 - 01:01
Thanks Mate..
You Saved My Day!!!
November 12th, 2012 - 04:53
I beleive I have set everything up correctly, when i run phpinfo() everything shows up. Although when i run within my browser i get an Error 101 (net::ERR_CONNECTION_RESET): The connection was reset.
November 12th, 2012 - 05:02
correction to my previous code..
For a test i took @George ‘s code and I had received that error 101.
(when i force error and change the file name to b.png ‘which does not exist’ it runs but shows error ”
Unable to read the file: b.png”)
try {
$im = new imagick( ‘a.png’ );
$im->thumbnailImage( 200, 0);
$im->writeImage( ‘a_thumbnail.jpg’’);
} catch (ImagickException $e) {
echo $e->getMessage();
}
November 12th, 2012 - 17:00
correction again… the above code has typo’s, none of which are actually present within my test page, the actual code is as follows:
try {
$im = new Imagick( ‘a.png’);
$im->thumbnailImage( 200, 0);
$im->writeImage( ‘a_thumbnail.png’);
} catch (ImagickException $e) {
echo $e->getMessage();
}
November 19th, 2012 - 06:35
PHP 5.4 php_imagick.dll is here: http://www.peewit.fr/imagick/ .
I read somewhere that 64bit php doesnt work with php_imagick. That might be the case when you get this error in apache_error.log
PHP Warning: PHP Startup: Unable to load dynamic library ‘c:/wamp/bin/php/php5.4.3/ext/php_imagick.dll’ -
%1 is not a valid Win32 application.\r\n in Unknown on line 0
As mentioned above, it was also necessary to add this into httpd.conf (also, i read you cant have spaces/dashes/dots):
SetEnv MAGICK_HOME C:/imagemagick”
If you dont, you might get this error:
“PHP Warning: PHP Startup: Unable to load dynamic library ‘c:/wamp/bin/php/php5.4.3/ext/php_imagick.dll’ -
The specified procedure could not be found. in Unknown on line 0″
December 3rd, 2012 - 12:38
Amazing instructions, thank you!
However, I had some problems concerning the dll, this is my solution for it, I hope it saves someone some time. I have php version 5.3.5 with wamp 2.1 and apache 2.2.17.
The nts dll downloaded from valokuva.org gave me this error, “The specified module could not be found.\r\n in Unknown on line 0″.
The ts dll downloaded also from there gave me the error about compilation and that they need to match.
The dll that worked for me was the php_imagick.dll, TS from here http://www.sk89q.com/2010/03/vc6-windows-binaries-for-imagick-2-3-0/
February 13th, 2013 - 14:38
Hi,
Really nice post.
works for me.
Please keep in mind that if you install static installation for windows then use static dll file for PHP extention
for me, error like – PHP Startup: Unable to load dynamic library ‘/wamp/bin/php/php5.2.9-2/ext/php_imagick.dll’ – The specified module could not be found.
is get solved by using proper dll file.
Thanks
April 4th, 2013 - 10:04
Thank you for your post! It’s very helpful for me!
May 7th, 2013 - 11:40
Hi,
First of all, it is a great article. But when I tried to run the above code, the following error message is displayed.
Fatal error: Class ‘imagick’ not found
I checked phpinfo() and i couldn’t see imagick library.I have tried with different versions and library without much help. I am using windows xp service pack 2 OS. Is the error has something to do with it?
Please help. Thanks.