diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-04-04 17:38:38 +0300 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-04-04 17:38:38 +0300 |
commit | b5c9189cfab736693c1edb8363d02c6b640c91c0 (patch) | |
tree | 80f1acfd24fa96b512ac3f3f1f4be37bb8fc20cd | |
parent | 498d3aea060ed496e2b5351108718e198b021d00 (diff) |
Fix imaginary with rotated exif images
Now do the operation in two steps:
1. Rotate the image according the exif data
2. Do the actual operation
This should only have a performance impact on image with exif rotation
data to do the rotation. For all the other images the autorotate steps
should be almost instant.
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
-rw-r--r-- | lib/private/Preview/Imaginary.php | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/private/Preview/Imaginary.php b/lib/private/Preview/Imaginary.php index 7e6ce86d4eb..4da88f1ab26 100644 --- a/lib/private/Preview/Imaginary.php +++ b/lib/private/Preview/Imaginary.php @@ -89,18 +89,26 @@ class Imaginary extends ProviderV2 { $mimeType = 'jpeg'; } - $parameters = [ - 'width' => $maxX, - 'height' => $maxY, - 'stripmeta' => 'true', - 'type' => $mimeType, + $operations = [ + [ + 'operation' => 'autorotate', + ], + [ + 'operation' => ($crop ? 'smartcrop' : 'fit'), + 'params' => [ + 'width' => $maxX, + 'height' => $maxY, + 'stripmeta' => 'true', + 'type' => $mimeType, + 'norotation' => 'true', + ] + ] ]; - try { $response = $httpClient->post( - $imaginaryUrl . ($crop ? '/smartcrop' : '/fit'), [ - 'query' => $parameters, + $imaginaryUrl . '/pipeline', [ + 'query' => ['operations' => json_encode($operations)], 'stream' => true, 'content-type' => $file->getMimeType(), 'body' => $stream, |