fix(images/resize): invoke rotate to auto-orient the image based on the EXIF data (#1250)

This commit is contained in:
Danny Avila 2023-11-30 13:59:51 -05:00 committed by GitHub
parent 2bcfb04a72
commit 98827440eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,7 +43,7 @@ async function resizeImage(inputFilePath, resolution) {
throw new Error('Invalid resolution parameter');
}
const resizedBuffer = await sharp(inputFilePath).resize(resizeOptions).toBuffer();
const resizedBuffer = await sharp(inputFilePath).rotate().resize(resizeOptions).toBuffer();
const resizedMetadata = await sharp(resizedBuffer).metadata();
return { buffer: resizedBuffer, width: resizedMetadata.width, height: resizedMetadata.height };