Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have managed to get imagemagick working (tested using the command line example on their website)
It also appears that the php extension is correctly installed: I can see it listed in my phpinfo(); list.

However, when I try to run the following code:

    $im = new imagick( 'examples.jpg' );
    $im->thumbnailImage( 200, 0);
    $im->writeImage( 'a_thumbnail.jpg' );

The execution stops at the second line, because it cannot find the thumbnailImage method.

What I can think of is that some user doesn't have enough privileges to access/run something else, but I obviously cannot give user access to everything.
Another possibility is that the PHP extension I'm using is not the suitable one for the latest imagemagick distribution.

share|improve this question
    
What OS and PHP version are you using? Did you install the extension via PEAR or through the OS package manager? –  SmallClanger Apr 21 '11 at 8:30
    
You can see the OS and PHP version in tags and title (win 2008, PHP 5.3.2). I installed the extension placing the compiled DLL in the extensions folder and adding it to the php.ini –  Razor Apr 21 '11 at 10:32
    
So I can, sorry. (Narrow browser window). Looks like you have the right version. Perhaps the previous line isn't creating the object? Does something basic like getImageLength() work on $im at that point? –  SmallClanger Apr 21 '11 at 10:40
    
The result of the first line is a null reference, so it doesn't even seem to be creating the object. I believe it might be because the process doesn't have the rights to run imagemagick, but trying to give them to users didn't change anything. –  Razor Apr 21 '11 at 23:03
    
If the user running the IIS process couldn't read/load the DLL, then it wouldn't show up in phpinfo(). Once it's loaded, then PHP should have access to all of the functionality, since there's no further file I/O required. It could be that the IIS user doesn't have the rights to, or can't find examples.jpg, and silently fails to instatiate the object as a result. This could be either a permissions issue or a environment/path problem. –  SmallClanger Apr 26 '11 at 8:48

3 Answers 3

up vote 0 down vote accepted

I have used following article to install image magic on my Windows 7 machine with IIS 7.5 and it is working fine. I would suggest to check the same:

http://gary-greendale.blogspot.com/2011/01/install-php-imagemagick-and-imagick-for.html

share|improve this answer
    
that is the tutorial I followed as well, and unfortunately I had no luck making it work –  Razor Apr 26 '11 at 22:00
    
May I know in what security context you are using your application pool? Have you tried to give run Application pool in Administrator context and tried this? –  maniargaurav Apr 27 '11 at 9:33

I've had the same issue. Take a look at the Visual Studio version used to compile a) ImageMagick, b) php_imagick.dll, c) php and take a look at the thread-safety-flags for the php. The Visual Studio versions have to be the same. The most important in this queue and this scenario is the VS version used to compile ImageMagick. They put the VS-C++ runtime-dll's in the ImageMagick installdir. They are named msvcr[71|90|100].dll and msvcp[71|90|100].dll.

My test was:

  1. run "convert logo: logo.gif" on the command-line
  2. run "imdisplay logo.gif" on the command-line (it failed for the latest ImageMagick-Version, because of an VS2010-and-ImageMagick-issue (http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=17303 && http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=17720)) --> downgraded ImageMagick to 6.5.9 (http://image_magick.veidrodis.com/image_magick/binaries/)
  3. run your php-script via command-line (/path/to/php.exe /path/to/php-script.php > /path/to/output.jpg) (it will fail if the VS-Versions do not match) (for me the php from (http://valokuva.org/?page_id=50) and the ImageMagick 6.5.9 worked)
  4. run the php-script through your webserver and browser
  5. raise the error_level in php (php_imagick raises an error if the temp-folder-write-permission are not correct) --> correct them (allow writes for the webserver-system-user)
  6. test step 4 again
  7. php_imagick runs on iis
share|improve this answer

Could be related to the fact that PHP is running in safe mode.

http://www.imagemagick.org/discourse-server/viewtopic.php?f=10&t=13055

http://www.theukwebdesigncompany.com/articles/php-imagemagick.php

quote: If your server is running PHP in safe mode, which it is likely to be if you're using a (free) shared host, your scripts don't have the right to execute shell commands. As this script runs ImageMagick as a shell command, you won't be able to use it. You could a. ask your hosting provider to disable safe mode or b. use the GD library to generate your images. ImageMagick is far more powerful than the GD library, but you can use the latter even in safe mode.

share|improve this answer
    
As I understand it, he's using the DLL extension version. This doesn't have the full feature set, but it doesn't rely on any exec() invocations, either, so safe mode shouldn't be a problem. –  SmallClanger Apr 26 '11 at 8:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.