views:

654

answers:

1

* This is now resolved * by clearing the temp folder in windows!

Some info - Windows 2003 server, IIS 6 ImageMagick 6.3.3 PHP 5.2.0

I am using ImageMagick to resize images on the server and I think this has recently been causing problems. What I am noticing is that when my PHP script executes the ImageMagick command the webpage freezes and will not reload. In fact I found that I have to clear the cache and cookies before I am able to reload the page and try again. Ive isolated the problem to the line of code that calls the imageMagick convert.exe. I get no response and using Mozilla Firebug to look at the traffic I can see that there is no data returned, no information about the page being called, simply it seems to hang.

The code that calls ImageMagick has not changed and has always worked previously (about 2 years!) and is as follows -

   $cmd = "convert.exe \"". $uploadfile . "\" -resize \"" . res_image_width ."x" . res_image_height . ">\" \"". $uploadfile. "\" 2>&1";
   passthru($cmd);
   //system($cmd);
   //exec($cmd);

(I have normally used passthru but I tried exec and system to see if I could return some info. )

I can run ImageMagick commands from the command line no problem and images get resized fine... so ImageMagick seems to be working fine, it just appears to be the PHP -> ImageMagick communication that is the problem. Im hoping restarting might solve it. Do you know anything else it could be? How would I go about debugging this?

many thanks

+1  A: 

Are you able to run other commands using passthru? e.g: passthru("dir");

And is res_image_width supposed to be $res_image_width? Make sure you have error_reporting enabled (include error_reporting(E_ALL); at the top of your script).

Joe Freeman
thanks for the tip about error_reporting ... incidentally I found that the temp folder on windows was chocka so I deleted some files and it all started working again... I'll update the question to show this.
undefined

related questions