Hello,
The new build page http://valokuva.org/magick
The installation steps should be somewhat like the following:
1. Install ImageMagick from http://imagemagick.org/script/binary-releases.php#windows. Choose Win32 dynamic at 16 bits-per-pixel. During the installation choose “Add to system path” or add the dir manually to your PATH.
2. Download php_imagick.dll from PHP 5.3 Windows builds and put it into your extension_dir. ts means thread-safe and nts is non-thread-safe. The latter is usually used with FastCGI.
3. Voila! You should now see imagick in phpinfo. If not, let me know.
#1 by Thomas on October 21, 2007 - 4:53 am
Quote
thirst of all, thanks for the great work!
while testing the latest windows extension (using the latest IM builds), i noticed adaptiveResizeImage not working with transparent PNGs. the resulting image is either completely black or completely white.
#2 by praveen on November 13, 2007 - 12:26 am
Quote
Hi, when ever i try to enable
extension=php_imagick_dyn-Q16.dll in my php.ini on windows xp, for php 5.2.5
it says
PHP Warning: PHP Startup: Unable to load dynamic library ‘d:/php/ext/php_imagick_dyn-Q16.dll’ – The specified module could not be found. in Unknown on line 0
even i tried copying to windows/system32 folder but same error.
Can you please advice?
#3 by Mikko Koppanen on November 13, 2007 - 12:46 am
Quote
praveen,
Where does you extension_dir point to?
#4 by praveen on November 13, 2007 - 6:29 pm
Quote
Dear Koppanen,
It points to ‘d:/php/ext/’
#5 by Adrian on November 14, 2007 - 12:30 am
Quote
PHP’s error message “The specified module could not be found.” is misleading. It does not only get displayed if the actual file doesn’t get found but also if the module fails to load, for whatever reason.
You have to mind two things, mentioned in watson’s thread:
* There should be no spaces in the path to ImageMagick. If you have it installed in “C:\Program Files\ImagMagick”, then that’s no good. Install it to “C:\ImageMagick” instead. (I didn’t test this and I’m not sure if this is really necessary).
* You have to set the MAGICK_HOME environment variable, for Imagick to find your ImageMagick installation. For apache, add following line to the end of your httpd.conf
SetEnv MAGICK_HOME “C:/ImageMagick”
(replace “C:/ImageMagick” with whatever path you have it installed and mind the slashes).
After reinstalling ImageMagick and setting the path the error message went away and Imagick loaded fine.
#6 by praveen on November 14, 2007 - 9:36 am
Quote
Hi Adrian,
GREAT!
When i changed the installation from ‘C:\Program Files\ImagMagick’ to ‘C:ImagMagick’
it worked fine..
Thank you
#7 by Nannotech on November 14, 2007 - 9:41 am
Quote
Mikko, thanks for the sample code.
I have a few questions:
- What is the difference between the dynamic (-dyn-)and the static builds of the Imagick extension?
I am assuming that the static builds do not need the full imagick installed. I also have imagick installed so I can’t be sure.
I am loading a static build and it thows an exception in the apache executable when I try to excute Mikko’s graph drawing sample. Other samples work ok, so I am assuming it has something to do with the class.
- Is there a new build for the latest 2.01?
thanks
#8 by Mikko Koppanen on November 14, 2007 - 9:46 am
Quote
Nannotech,
1. To simplify the differences between dynamic and static build: dynamic requires you to install ImageMagick and static doesn’t. The latter would ideal, but seems like static builds have all kind of funky stuff going on; transparent pngs turn out black, drawing mysteriously fails in some cases and so on.
2. What is the exception message you get? “Non-comforming drawing primitive definition” ?
3. No, not currently because I don’t have a MSVS license. Building ImageMagick and Imagick with the Express Edition is way beyong my knowledge of the platform.
#9 by Nannotech on November 14, 2007 - 11:48 am
Quote
OK. Now it is working.
I changed over to the dynamic extension and installed the latest imagick binaries (ImageMagick-6.3.6-10-Q16-windows-dll.exe) and voila! the graph is there. Also some code I wrote, imagickally, started working.
Thanks.
#10 by Adrian on November 16, 2007 - 1:39 am
Quote
Is there a way to check if an Imagick object actually contains an image?
I tried getNumberImages() and valid() but both throw a ‘Can not process empty wand’ exception rather than returning 0 and false respectively, as I would expect.
#11 by Mikko Koppanen on November 16, 2007 - 9:30 am
Quote
Adrian,
seems like you have stumbled across a bug. getNumberImages should not throw an exception even if there was 0 images. I just committed a fix to the CVS.
#12 by Chet on November 27, 2007 - 7:40 pm
Quote
Mikko,
I followed the instructions above as well as I’ve tried the different dll’s for windows. I still cannot get PHP to recognize the imagick dll when the apache server starts. There’s no error message, just doesn’t appear in phpinfo().
I set the env variable for MAGICK_HOME to c:/ImageMagick, which is where the product resides.
I set the extension in my php.ini file to:
extension=php_imagick_dyn-Q8.dll
My extension dir is c:/xampp/php/ext and the dll is there. What could I be missing?
Any help is appreciated.
#13 by Adrian on November 28, 2007 - 11:22 pm
Quote
@Chet
Make sure you are editing the correct php.ini. Your phpinfo() has the path to the ini it loads.
Secondly, make sure you have enabled display_startup_errors and take a look at apache’s error_log.
#14 by Chet on November 29, 2007 - 1:42 am
Quote
Adrian,
Thank you the display_startup_errors helped. I’m set now.
Chet
#15 by Thomas on November 29, 2007 - 5:46 pm
Quote
i love it!
when can we expect a fresh build?
#16 by Mikko Koppanen on November 29, 2007 - 5:59 pm
Quote
Thomas,
If I understood correctly I should receive a copy of Visual Studio any day now. As soon as I get the box I will create fresh builds!
#17 by Mikko Koppanen on December 2, 2007 - 8:09 pm
Quote
The latest build shoud not crash webserver during start up.
#18 by Lars van den Noort on December 3, 2007 - 12:08 am
Quote
Thx Mikko, I can confirm that for the dynamic Q16 version that I use.
#19 by Dustin on December 3, 2007 - 9:56 pm
Quote
Do you happen to know why imagick was left out of the latest build for windows (php 5.2.5)?
#20 by Mikko Koppanen on December 3, 2007 - 10:18 pm
Quote
Dustin,
you mean the ones built in http://snaps.php.net ?
#21 by Thomas on December 6, 2007 - 2:49 am
Quote
thanks a bunch for the fresh build!
#22 by sskaje on December 6, 2007 - 5:00 pm
Quote
I tried to build imagick myself
but i got two errors when linking
Linking…
Creating library Release_TS/php_magickwand.lib and object Release_TS/php_magickwand.exp
imagick.obj : error LNK2001: unresolved external symbol _executor_globals_id
imagick.obj : error LNK2001: unresolved external symbol _zend_ce_iterator
..\..\Release_TS\php_magickwand.dll : warning LNK4088: image being generated due to /FORCE option; image may not run
then i build the php 5.2.5 myself and use the php5ts.lib myself
but those errors still exist
could you please help me with it?
PS: i compiled my php 5.2.5, imagemagick 6.3.7-2 and imagick 2.0.1 stable with ms vc6 on ms win2k3
#23 by cfing on December 20, 2007 - 1:41 pm
Quote
Hi
I have been struggling to get PHP/Imagick working on my Windows platform for some time. From your examples, it look as though it is exactly the software that I need for a current project.
However, I have downloaded and installed ImageMagick-6.3.7-6-Q16-windows-dll.exe – that appears to be working, as in I can open images and manipulate them.
The correct path to the Imagemagick directory has been added to the PATH environment variable and the PC restarted.
I have downloaded and copied into the php/ext directory various static/dynamic imagick dlls, including the ones you reference above.
I have added the setting SetEnv MAGICK_HOME “H:/ImageMagick” to httpd.conf.
I have added the correct line in php.ini: extension=php_imagick.dll
I restart Apache and every time I get:
[20-Dec-2007 17:26:28] PHP Warning: PHP Startup: Unable to load dynamic library ‘h:\php\ext\php_imagick.dll’ – The specified procedure could not be found.
in Unknown on line 0
Any suggestions gratefully received and tested!!!
Many thanks in anticipation
Clinton
#24 by Pieje on December 20, 2007 - 4:50 pm
Quote
Hej Mikko
It’s awesome what you are doing!
The imagick extensions I found on pecl4win.php.net have been compiled against an old version of Imagemagick and I had a lot of problems getting them to work (If at all they worked). Yours however just works..clap clap clap.
I have one small petition tho..
Would it be possible to get the Q8 version of the static dll? Since Q8 is better for web use..
I’m sorry to having you to bother with this, in a near future I’m planning on compiling PHP myself with the necessary extensions, so I won’t have to bother you with these kind of requests anymore. Yeah..wish me luck
Thanks again.
Greets from Belgium/Spain
#25 by Mikko Koppanen on December 20, 2007 - 9:33 pm
Quote
Pieje,
I’ll try to get some time to roll one tonight.
#26 by Pieje on December 21, 2007 - 12:04 pm
Quote
Hej Mikko,
Thanks a bunch! I really appreciate it.
Also I wish to report a bug/problem in Windows Vista.
When executing PHP with the imagick module enabled Vista shows me the following error:
CLI HAS STOPPED WORKING
Problem signature:
Problem Event Name: APPCRASH
Application Name: php.exe
Application Version: 5.2.5.5
Application Timestamp: 4733dfab
Fault Module Name: ntdll.dll
Fault Module Version: 6.0.6000.16386
Fault Module Timestamp: 4549bdc9
Exception Code: c0000005
Exception Offset: 00061884
OS Version: 6.0.6000.2.0.0.256.4
Locale ID: 1033
Additional Information 1: c782
Additional Information 2: b161410011ea1dc4dd59ee66dd70d582
Additional Information 3: aa93
Additional Information 4: 5af9e0d94a60d378a08a234fc7bccdd2
I tried with the php_imagick_static-Q16.dll (released 021207) as well as with php_imagick_dyn-Q8.dll (from last month).
When I disable the imagick module, everything runs fine.
The same setup works fine in XP btw..
Please let me know if you need any more information.
Ciao,
Pieje
#27 by Pieje on December 21, 2007 - 5:40 pm
Quote
Hi Mikko,
I ran a strace on php.exe and this is what I got:
[T1020] HeapFree(1960000, 0, 1089108, 46f844b9, …) = 1
= 1089fc0
[T1020] zend_class_implements(1089fc0, 1962668, 1, 1ca15ff, …) [T1020] HeapAlloc(1960000, 0, 4, 0, …) = 108ffc0
Exception = c0000005, Address = 1009a74b (first-chance!)
[T1020] VirtualQuery(4051f8, c0eee8, 1c, 46f858a5, …) = 1c
[T1020] InterlockedExchange(76c840e8, 1, 46f858a5, 4051f8, …) = 0
[T1020] InterlockedExchange(76c840e8, 0, 46f858a5, 4051f8, …) = 1
[T1020] GetLastError(0, 0, 76c44f0b, 0, …) = 0
[T1020] FlsGetValue(1, 0, 0, 76c44f0b, …) = 19607d8
[T1020] SetLastError(0, 0, 0, 76c44f0b, …) = 0
Exception = c0000005, Address = 1009a74b (second-chance!)
Target process has been terminated. Exit Code = -1073741819.
I’ve seen that the zend_class_implements function is part of php4ts.dll and is declared inside of zend_api.h
Hope this helps.
#28 by Mikko Koppanen on December 22, 2007 - 1:16 am
Quote
Pieje,
I know there’s some (crashing) issues on Vista. After hours and hours of debugging I couldn’t locate the problem. I will get some help on debugging at 27th of this month. Hopefully the issue will be resolved soon.
#29 by Pieje on December 22, 2007 - 5:20 am
Quote
I’ll stay tuned.
If there is anything I can help with (testing, etc), please let me know.
#30 by hamza on December 29, 2007 - 4:28 am
Quote
hi Mikko.
my local computer has an OS win xp sp2
i have installed typo3 on my local computer in this folder: c:\Program Files\typo3
typo3 install’s an appache server
i installed imagemagick using ImageMagick-6.3.7-8-Q16-windows-dll.exe. from http://www.imagemagick.org/script/binary-releases.php#windows..
now, i tried to install imagick….but i didn’t understand as well how to..
- i have download Imagick 2.1.0RC1.tgz from http://pecl.php.net/
- my appache folder is on c:\Program Files\typo3\appache
- php 5.2.1
- imagemagick is installed on C:\ImageMagick-6.3.7-Q16
when i run some example script which cals a class Imagick …i got this error message
“Fatal error: Cannot instantiate non-existent class: imagick in…”
cheers
#31 by Ashley on December 29, 2007 - 7:57 pm
Quote
Has anyone managed to get ImageMagick to work on IIS6 (Server 2003)? I’m using PHP 5.2.4 and ImageMagick-6.3.7-8-Q16-windows-dll.exe with php_imagick_dyn-Q16.dll and it just won’t load when I run PHP. I get the helpful error ‘PHP Startup: Unable to load dynamic library ‘c:/php/ext/php_imagick_dyn-Q16.dll’ – The application has failed to start because the application configuration is incorrect. Reinstalling the application may fix the problem.’ The really annoying thing is I’ve got it running fine on Vista with IIS7 which I would have expected to have problems with! I’ve tried everything I can think of, I even gave everyone full permission to the system (dont’ worry it’s just a test server!)
#32 by Ashley on December 30, 2007 - 9:16 pm
Quote
After several hours (8+!) of wondering why it wouldn’t work on IIS I finally found out why. You need to have the ‘Microsoft Visual C++ 2005 SP1 Redistributable Package’ installed. You can get this package here http://www.microsoft.com/downloads/details.aspx?familyid=200b2fd9-ae1a-4a14-984d-389c36f85647 The only reason it worked on my Vista test machine was because I happened to already have the update installed via Visual Studio 2005 SP1
#33 by Ashley on December 31, 2007 - 10:49 pm
Quote
Do you happen to know if this package can read Abode Illustrator files (*.ai)? Only I can’t seem to get them to work (even just a basic read in and write straight to the browser). EPS files work just fine which also use ghostscript so I don’t believe that to be the problem. The *.ai files work fine directly in imageMagick. It’s not the end of the world if it can’t read them as I’m not going to be using them, it’s just something I happened to notice while playing about with the code.
#34 by Ashley on January 1, 2008 - 4:59 pm
Quote
I’ve done a little bit of digging to try and find out why *.ai files don’t work and it looks like PHP is trying to load an imagemagick dll called IM_MOD_RL_AI_.dll which doesn’t exist. Is this maybe a legacy file that is now called something else?
#35 by Mikko Koppanen on January 1, 2008 - 7:59 pm
Quote
Ashley,
are you using the dynamic or the static build?
#36 by Ashley on January 2, 2008 - 3:37 pm
Quote
The dynamic build, I’ve tried both the Q8 and Q16 versions (although I’m not 100% sure that would make any difference!). If you want any test files or more info please feel free to email me.
#37 by Pieje on January 8, 2008 - 12:39 pm
Quote
Hi Mikko.
My best wishes for the new year. Keep up the good work.
Thought I just check to see if there is any update on the crashing issues in Windows Vista?
cheers,
Pieter
#38 by Derek Schrock on January 12, 2008 - 12:25 am
Quote
Hello, Mikko. Thanks for the work getting Imagick working on Windows and thanks to Ashley for IIS comments they helped. I was so excited to get this working under IIS6 the first thing I did with Imagick was: , just to see if it was working.
Fatal error: Uncaught exception ‘ImagickException’ with message ‘Unable to read the file: test.jpg’ in C:\Inetpub\wwwroot\im.php:3 Stack trace: #0 C:\Inetpub\wwwroot\im.php(3): Imagick->__construct(‘test.jpg’) #1 {main} thrown in C:\Inetpub\wwwroot\im.php on line 3
I’m sure the fix is simple but I can’t see to find the solution.
JPEG and JPG are both supported images according to phpinfo(), the image file has the correct permissions and is in the same directory as im.php
Thanks
#39 by Mikko Koppanen on January 12, 2008 - 12:37 am
Quote
Derek,
does it work if you specify full path to the images?
#40 by Derek Schrock on January 12, 2008 - 12:42 am
Quote
No.
#41 by Derek Schrock on January 12, 2008 - 12:45 am
Quote
Also I didn’t notice it with my first post but my PHP code was stripped out by the comment system. Simple one line:
$image = new Imagick( “test.jpg” );
#42 by Ashley on January 13, 2008 - 7:06 pm
Quote
Derek
Is it possible for you post your full php file and a link to the jpg file you’re trying to use? If it is I’ll try it for you on my IIS servers (v6 and v7). I’ve already tried using
with my own image and it worked fine for me.
P.S. I just realised Mikko I never thanked you for your work on this, sorry. Thanks for all your work it’s much appreciated
#43 by Mikko Koppanen on January 13, 2008 - 7:47 pm
Quote
Ashley,
browse to http://phpfi.com , paste the code there and provide an URL.
#44 by Ashley on January 13, 2008 - 8:04 pm
Quote
Thanks Mikko. Feel free to delete all those other comments
See here for the code http://phpfi.com/289500
#45 by Derek Schrock on January 14, 2008 - 5:15 am
Quote
Ashley,
http://phpfi.com/289597
http://hobbyspeed.com/dereks/test.jpg
Error:
Fatal error: Uncaught exception ‘ImagickException’ with message ‘Unable to read the file: test.jpg’ in C:\Inetpub\wwwroot\hobbyspeed\dereks\im.php:2 Stack trace: #0 C:\Inetpub\wwwroot\hobbyspeed\dereks\im.php(2): Imagick->__construct(‘test.jpg’) #1 {main} thrown in C:\Inetpub\wwwroot\hobbyspeed\dereks\im.php on line 2
#46 by Mikko Koppanen on January 14, 2008 - 5:26 am
Quote
Derek,
I noticed that the current build throws error message “Unable to read the file” even if the real error is something else. I will try to get some time tomorrow to update the Windows builds.
#47 by Derek Schrock on January 14, 2008 - 5:56 am
Quote
Excellent! Thanks
#48 by Ashley on January 14, 2008 - 7:42 pm
Quote
Derek
I’ve tried your code on IIS6 and IIS7 and it works fine on both for me. Or at least I don’t get any error messages, since you’re not outputing the image in your code
#49 by Derek Schrock on January 14, 2008 - 11:32 pm
Quote
No, just IIS6 (that’s all I have). I have a feeling it’s a stupid error on my part due to a permission issue.
For instance, I can execute the following code ( http://valokuva.org/?p=60 ).
But say I want to write that image to disk before it’s sent off to the client ( $canvas->writeImage(‘foo.png’); ) I’ll get this error message: “PHP has encountered an Access Violation at 03150FD4″
#50 by Mikko Koppanen on January 14, 2008 - 11:35 pm
Quote
Derek,
the access violation is probably related to this: http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=10415