/[drupal]/contributions/modules/imageapi/imageapi_imagemagick.module
ViewVC logotype

Diff of /contributions/modules/imageapi/imageapi_imagemagick.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.17.2.4, Fri Apr 17 17:58:03 2009 UTC revision 1.17.2.5, Fri May 29 17:48:32 2009 UTC
# Line 1  Line 1 
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
# Line 178  function _imageapi_imagemagick_convert_e Line 178  function _imageapi_imagemagick_convert_e
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(
# Line 191  function _imageapi_imagemagick_convert_e Line 195  function _imageapi_imagemagick_convert_e
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]);

Legend:
Removed from v.1.17.2.4  
changed lines
  Added in v.1.17.2.5

  ViewVC Help
Powered by ViewVC 1.1.2