Index: imageapi_imagemagick.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/imageapi/imageapi_imagemagick.module,v retrieving revision 1.17.2.4 diff -u -p -r1.17.2.4 imageapi_imagemagick.module --- imageapi_imagemagick.module 17 Apr 2009 17:58:03 -0000 1.17.2.4 +++ imageapi_imagemagick.module 14 May 2009 16:36:45 -0000 @@ -178,12 +178,16 @@ function _imageapi_imagemagick_convert_e return FALSE; } + // Specify Drupal's root as the working a working directory so that relative + // paths are interpreted correctly. + $drupal_path = $_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['SCRIPT_FILENAME']); + if (strstr($_SERVER['SERVER_SOFTWARE'], 'Win32') || strstr($_SERVER['SERVER_SOFTWARE'], 'IIS')) { // Use Window's start command to avoid the "black window" from showing up: // http://us3.php.net/manual/en/function.exec.php#56599 // Use /D to run the command from PHP's current working directory so the // file paths don't have to be absolute. - $convert_path = 'start "window title" /D'. escapeshellarg(getcwd()) .' /B '. escapeshellarg($convert_path); + $convert_path = 'start "window title" /D'. escapeshellarg($drupal_path) .' /B '. escapeshellarg($convert_path); } $descriptors = array( @@ -191,7 +195,7 @@ function _imageapi_imagemagick_convert_e 1 => array('pipe', 'w'), // stdout 2 => array('pipe', 'w') // stderr ); - if ($h = proc_open($convert_path .' '. $command_args, $descriptors, $pipes, $_SERVER['DOCUMENT_ROOT'])) { + if ($h = proc_open($convert_path .' '. $command_args, $descriptors, $pipes, $drupal_path)) { $output = ''; while (!feof($pipes[1])) { $output .= fgets($pipes[1]);