From d709a607afc5b156081e446dd089838e49836639 Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Fri, 19 Apr 2019 17:48:17 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20#97=20=E2=80=94=20Revert=20"Fix=20#90=20?= =?UTF-8?q?=E2=80=94=20catch=20Image::Magick=20problems"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 998db0cb90b416f92d78edfd67bdd493cbfae62a. --- lib/Lutim/Controller/Image.pm | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/Lutim/Controller/Image.pm b/lib/Lutim/Controller/Image.pm index 5658513..e3bbc62 100644 --- a/lib/Lutim/Controller/Image.pm +++ b/lib/Lutim/Controller/Image.pm @@ -401,25 +401,25 @@ sub add { my ($width, $height); if ($im_loaded && $mediatype ne 'image/svg+xml' && $mediatype !~ m#image/(x-)?xcf# && $mediatype ne 'image/webp') { # ImageMagick don't work in Debian with svg (for now?) my $im = Image::Magick->new; - if($im->BlobToImage($upload->slurp)) { - # Automatic rotation from EXIF tag - $im->AutoOrient(); + $im->BlobToImage($upload->slurp); - # Update the uploaded file with it's auto-rotated clone - my $asset = Mojo::Asset::Memory->new->add_chunk($im->ImageToBlob()); - $upload->asset($asset); + # Automatic rotation from EXIF tag + $im->AutoOrient(); - # Create the thumbnail - $width = $im->Get('width'); - $height = $im->Get('height'); - $im->Resize(geometry=>'x85'); + # Update the uploaded file with it's auto-rotated clone + my $asset = Mojo::Asset::Memory->new->add_chunk($im->ImageToBlob()); + $upload->asset($asset); - $thumb = 'data:'.$mediatype.';base64,'; - if ($mediatype eq 'image/gif') { - $thumb .= b64_encode $im->[0]->ImageToBlob(); - } else { - $thumb .= b64_encode $im->ImageToBlob(); - } + # Create the thumbnail + $width = $im->Get('width'); + $height = $im->Get('height'); + $im->Resize(geometry=>'x85'); + + $thumb = 'data:'.$mediatype.';base64,'; + if ($mediatype eq 'image/gif') { + $thumb .= b64_encode $im->[0]->ImageToBlob(); + } else { + $thumb .= b64_encode $im->ImageToBlob(); } }