Image tools: Use which() instead of reimplementing (should also work on win32 now)
--- a/imagetools.php Tue May 26 15:26:59 2009 -0400
+++ b/imagetools.php Fri Jun 12 11:38:43 2009 -0400
@@ -93,18 +93,9 @@
}
// try to find convert in the PATH
- // FIXME: unix specific (won't work on windows)
- $path = ( isset($_ENV['PATH']) ) ? $_ENV['PATH'] : ( isset($_SERVER['PATH']) ? $_SERVER['PATH'] : '/usr/local/bin:/usr/bin:/bin' );
- $path = explode(':', $path);
- foreach ( $path as $dir )
- {
- if ( file_exists("$dir/convert") && is_executable("$dir/convert") )
- {
- $magick_path = "$dir/convert";
- }
- }
+ $magick_path = which('convert');
- $can_use_magick = isset($magick_path);
+ $can_use_magick = !empty($magick_path);
$can_use_gd = (
function_exists('getimagesize') &&
function_exists('imagecreatetruecolor') &&