| 1 |
<?php // $Id: imageapi_imagemagick.module,v 1.17.2.3 2009/03/18 07:59:56 drewish Exp $ |
<?php // $Id: imageapi_imagemagick.module,v 1.17.2.4 2009/04/17 17:58:03 drewish Exp $ |
| 2 |
|
|
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 178 |
return FALSE; |
return FALSE; |
| 179 |
} |
} |
| 180 |
|
|
| 181 |
|
// Specify Drupal's root as the working a working directory so that relative |
| 182 |
|
// paths are interpreted correctly. |
| 183 |
|
$drupal_path = $_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['SCRIPT_FILENAME']); |
| 184 |
|
|
| 185 |
if (strstr($_SERVER['SERVER_SOFTWARE'], 'Win32') || strstr($_SERVER['SERVER_SOFTWARE'], 'IIS')) { |
if (strstr($_SERVER['SERVER_SOFTWARE'], 'Win32') || strstr($_SERVER['SERVER_SOFTWARE'], 'IIS')) { |
| 186 |
// Use Window's start command to avoid the "black window" from showing up: |
// Use Window's start command to avoid the "black window" from showing up: |
| 187 |
// http://us3.php.net/manual/en/function.exec.php#56599 |
// http://us3.php.net/manual/en/function.exec.php#56599 |
| 188 |
// Use /D to run the command from PHP's current working directory so the |
// Use /D to run the command from PHP's current working directory so the |
| 189 |
// file paths don't have to be absolute. |
// file paths don't have to be absolute. |
| 190 |
$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); |
| 191 |
} |
} |
| 192 |
|
|
| 193 |
$descriptors = array( |
$descriptors = array( |
| 195 |
1 => array('pipe', 'w'), // stdout |
1 => array('pipe', 'w'), // stdout |
| 196 |
2 => array('pipe', 'w') // stderr |
2 => array('pipe', 'w') // stderr |
| 197 |
); |
); |
| 198 |
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)) { |
| 199 |
$output = ''; |
$output = ''; |
| 200 |
while (!feof($pipes[1])) { |
while (!feof($pipes[1])) { |
| 201 |
$output .= fgets($pipes[1]); |
$output .= fgets($pipes[1]); |