Explorar o código

fix(asset-server-plugin): Use EXIF data to correctly orient images

Fixes #1548
Michael Bromley %!s(int64=3) %!d(string=hai) anos
pai
achega
aa9bd03e90

+ 2 - 2
packages/asset-server-plugin/src/sharp-asset-preview-strategy.ts

@@ -21,13 +21,13 @@ export class SharpAssetPreviewStrategy implements AssetPreviewStrategy {
             const width = metadata.width || 0;
             const width = metadata.width || 0;
             const height = metadata.height || 0;
             const height = metadata.height || 0;
             if (maxWidth < width || maxHeight < height) {
             if (maxWidth < width || maxHeight < height) {
-                return image.resize(maxWidth, maxHeight, { fit: 'inside' }).toBuffer();
+                return image.rotate().resize(maxWidth, maxHeight, { fit: 'inside' }).toBuffer();
             } else {
             } else {
                 if (mimeType === 'image/svg+xml') {
                 if (mimeType === 'image/svg+xml') {
                     // Convert the SVG to a raster for the preview
                     // Convert the SVG to a raster for the preview
                     return image.toBuffer();
                     return image.toBuffer();
                 } else {
                 } else {
-                    return data;
+                    return image.rotate().toBuffer();
                 }
                 }
             }
             }
         } else {
         } else {