aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App/Controller/Photo.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Photo.pm b/perllib/FixMyStreet/App/Controller/Photo.pm
index a2ec7d4c8..ae0be9d8a 100644
--- a/perllib/FixMyStreet/App/Controller/Photo.pm
+++ b/perllib/FixMyStreet/App/Controller/Photo.pm
@@ -9,6 +9,8 @@ use Digest::SHA qw(sha1_hex);
use File::Path;
use File::Slurp;
use Image::Size;
+use IPC::Cmd qw(can_run);
+use IPC::Open3;
use Path::Class;
use if !$ENV{TRAVIS}, 'Image::Magick';
@@ -181,7 +183,13 @@ sub process_photo_upload : Private {
# get the photo into a variable
my $photo_blob = eval {
my $filename = $upload->tempname;
- my $out = `jhead -se -autorot $filename 2>&1`;
+ my $out;
+ if (can_run('jhead')) {
+ my $pid = open3(undef, my $stdout, undef, 'jhead', '-se', '-autorot', $filename);
+ $out = join('', <$stdout>);
+ waitpid($pid, 0);
+ close $stdout;
+ }
unless (defined $out) {
my ($w, $h, $err) = Image::Size::imgsize($filename);
die _("Please upload a JPEG image only") . "\n" if !defined $w || $err ne 'JPG';