From 112aa4b48f8711bc8d407c7abbecc535f982c1a3 Mon Sep 17 00:00:00 2001 From: Denis Fedoseev Date: Wed, 19 Jul 2017 16:01:12 +0900 Subject: [PATCH] Better rotation handling --- fotostore.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fotostore.pl b/fotostore.pl index 220946a..22f67ed 100644 --- a/fotostore.pl +++ b/fotostore.pl @@ -166,10 +166,11 @@ post '/upload' => (authenticated => 1)=> sub { my $imager = Imager->new(); $imager->read(file => $image_file) or die $imager->errstr; - + #http://sylvana.net/jpegcrop/exif_orientation.html - my $rotation_angle = $imager->tags( name => "exif_orientation"); - $self->app->log->info("Rotation angle [".$rotation_angle."]"); + #http://myjaphoo.de/docs/exifidentifiers.html + my $rotation_angle = $imager->tags( name => "exif_orientation") || 1; + $self->app->log->info("Rotation angle [".$rotation_angle."] [".$image->filename."]"); for my $scale (@scale_width) { if ($rotation_angle == 3) { @@ -187,7 +188,7 @@ post '/upload' => (authenticated => 1)=> sub { $self->render(json => {files => [ { - name => $filename, + name => $image->filename, size => $image->size, url => sprintf('/images/orig/%s', $filename), thumbnailUrl => sprintf('/images/200/%s', $filename),