Przeglądaj źródła

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

Fixes #1548
Michael Bromley 3 lat temu
rodzic
commit
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 height = metadata.height || 0;
             if (maxWidth < width || maxHeight < height) {
-                return image.resize(maxWidth, maxHeight, { fit: 'inside' }).toBuffer();
+                return image.rotate().resize(maxWidth, maxHeight, { fit: 'inside' }).toBuffer();
             } else {
                 if (mimeType === 'image/svg+xml') {
                     // Convert the SVG to a raster for the preview
                     return image.toBuffer();
                 } else {
-                    return data;
+                    return image.rotate().toBuffer();
                 }
             }
         } else {