Skip to content

Commit 40f6f60

Browse files
authored
Merge pull request #31829 from nextcloud/fix/exif-imaginary
Fix imaginary with rotated exif images
2 parents 1fbb58b + b5c9189 commit 40f6f60

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

lib/private/Preview/Imaginary.php

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,26 @@ public function getCroppedThumbnail(File $file, int $maxX, int $maxY, bool $crop
8989
$mimeType = 'jpeg';
9090
}
9191

92-
$parameters = [
93-
'width' => $maxX,
94-
'height' => $maxY,
95-
'stripmeta' => 'true',
96-
'type' => $mimeType,
92+
$operations = [
93+
[
94+
'operation' => 'autorotate',
95+
],
96+
[
97+
'operation' => ($crop ? 'smartcrop' : 'fit'),
98+
'params' => [
99+
'width' => $maxX,
100+
'height' => $maxY,
101+
'stripmeta' => 'true',
102+
'type' => $mimeType,
103+
'norotation' => 'true',
104+
]
105+
]
97106
];
98107

99-
100108
try {
101109
$response = $httpClient->post(
102-
$imaginaryUrl . ($crop ? '/smartcrop' : '/fit'), [
103-
'query' => $parameters,
110+
$imaginaryUrl . '/pipeline', [
111+
'query' => ['operations' => json_encode($operations)],
104112
'stream' => true,
105113
'content-type' => $file->getMimeType(),
106114
'body' => $stream,

0 commit comments

Comments
 (0)