imagetools.php
changeset 73 1f55c324efcf
parent 40 bd3372a2afc1
equal deleted inserted replaced
72:b8730fcd64a9 73:1f55c324efcf
    91     default:
    91     default:
    92       return false;
    92       return false;
    93   }
    93   }
    94     
    94     
    95   // try to find convert in the PATH
    95   // try to find convert in the PATH
    96   // FIXME: unix specific (won't work on windows)
    96   $magick_path = which('convert');
    97   $path = ( isset($_ENV['PATH']) ) ? $_ENV['PATH'] : ( isset($_SERVER['PATH']) ? $_SERVER['PATH'] : '/usr/local/bin:/usr/bin:/bin' );
    97   
    98   $path = explode(':', $path);
    98   $can_use_magick = !empty($magick_path);
    99   foreach ( $path as $dir )
       
   100   {
       
   101     if ( file_exists("$dir/convert") && is_executable("$dir/convert") )
       
   102     {
       
   103       $magick_path = "$dir/convert";
       
   104     }
       
   105   }
       
   106   
       
   107   $can_use_magick = isset($magick_path);
       
   108   $can_use_gd = (
    99   $can_use_gd = (
   109       function_exists('getimagesize')         &&
   100       function_exists('getimagesize')         &&
   110       function_exists('imagecreatetruecolor') &&
   101       function_exists('imagecreatetruecolor') &&
   111       function_exists('imagecopyresampled')   &&
   102       function_exists('imagecopyresampled')   &&
   112       function_exists($func)
   103       function_exists($func)