/[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.22, Fri Apr 17 17:57:53 2009 UTC revision 1.23, Fri May 29 17:48:48 2009 UTC
# Line 1  Line 1 
1  <?php  // $Id: imageapi_imagemagick.module,v 1.21 2009/03/11 05:42:47 drewish Exp $  <?php  // $Id: imageapi_imagemagick.module,v 1.22 2009/04/17 17:57:53 drewish Exp $
2    
3  /**  /**
4   * @file   * @file
# Line 184  function _imageapi_imagemagick_convert_e Line 184  function _imageapi_imagemagick_convert_e
184      return FALSE;      return FALSE;
185    }    }
186    
187      // Specify Drupal's root as the working a working directory so that relative
188      // paths are interpreted correctly.
189      $drupal_path = $_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['SCRIPT_FILENAME']);
190    
191    if (strstr($_SERVER['SERVER_SOFTWARE'], 'Win32') || strstr($_SERVER['SERVER_SOFTWARE'], 'IIS')) {    if (strstr($_SERVER['SERVER_SOFTWARE'], 'Win32') || strstr($_SERVER['SERVER_SOFTWARE'], 'IIS')) {
192      // 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:
193      // http://us3.php.net/manual/en/function.exec.php#56599      // http://us3.php.net/manual/en/function.exec.php#56599
194      // 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
195      // file paths don't have to be absolute.      // file paths don't have to be absolute.
196      $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);
197    }    }
198    
199    $descriptors = array(    $descriptors = array(
# Line 197  function _imageapi_imagemagick_convert_e Line 201  function _imageapi_imagemagick_convert_e
201      1 => array('pipe', 'w'), // stdout      1 => array('pipe', 'w'), // stdout
202      2 => array('pipe', 'w')  // stderr      2 => array('pipe', 'w')  // stderr
203    );    );
204    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)) {
205      $output = '';      $output = '';
206      while (!feof($pipes[1])) {      while (!feof($pipes[1])) {
207        $output .= fgets($pipes[1]);        $output .= fgets($pipes[1]);

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

  ViewVC Help
Powered by ViewVC 1.1.2