mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
fix(images/resize): invoke rotate to auto-orient the image based on the EXIF data (#1250)
This commit is contained in:
parent
2bcfb04a72
commit
98827440eb
1 changed files with 1 additions and 1 deletions
|
|
@ -43,7 +43,7 @@ async function resizeImage(inputFilePath, resolution) {
|
||||||
throw new Error('Invalid resolution parameter');
|
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();
|
const resizedMetadata = await sharp(resizedBuffer).metadata();
|
||||||
return { buffer: resizedBuffer, width: resizedMetadata.width, height: resizedMetadata.height };
|
return { buffer: resizedBuffer, width: resizedMetadata.width, height: resizedMetadata.height };
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue