Better rotation handling

This commit is contained in:
Denis Fedoseev 2017-07-19 16:01:12 +09:00
parent bc94cf961d
commit 112aa4b48f

View file

@ -168,8 +168,9 @@ post '/upload' => (authenticated => 1)=> sub {
$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),