X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=upload.php;h=f6a196b0ccd790d2368246fe09bba45270dc7a82;hb=0bdfef457a85585b652827116173a939e4172d0e;hp=e349cf08439a567cd491264f7f9d2d5869d6bdd3;hpb=a1011831f5cf76e4cb8b1c0b5c5332cd82ca2d7b;p=wfpl.git diff --git a/upload.php b/upload.php index e349cf0..f6a196b 100644 --- a/upload.php +++ b/upload.php @@ -185,10 +185,10 @@ function path_to($prog, $or_die = true) { function _path_to($prog, $or_die) { # relies on PHP's short-circuit mechanism - if(file_exists($convert = "/usr/local/bin/$prog") || - file_exists($convert = "/usr/bin/$prog") || - ($convert = `which convert` != '' && file_exists($convert))) { - return $convert; + if(file_exists($path = "/usr/local/bin/$prog") || + file_exists($path = "/usr/bin/$prog") || + ($path = `which $prog` != '' && file_exists($path))) { + return $path; } else { if($or_die) { die("Failed to locate '$prog' executable."); @@ -268,7 +268,7 @@ function make_thumbnail($filename, $max_width = '70', $max_height = '70') { function image_dimensions($image) { $identify = path_to('identify'); $command = "$identify -format '%wx%h' " . escapeshellarg($image); - $dimensions = substr(`$command`, 0, -1); # substr() to remove newline + $dimensions = rtrim(`$command`); if($dimensions == '') { return false; } else {