UBERF-9637 Fix: prevent sharp rotating image on resize (#8256)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2025-03-18 09:18:01 +07:00 committed by GitHub
parent d3ffb3c2fd
commit b531cf2cce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -926,6 +926,9 @@ async function getGeneratePreview (
}
sharp.cache(false)
// auto orient image based on exif to prevent resize use wrong orientation
pipeline = pipeline.rotate()
pipeline = pipeline.resize({
width: size,
fit: 'cover',

View File

@ -105,6 +105,10 @@ export async function handleImageGet (
await writeFile(tmpFile, blob.body)
let pipeline = sharp(tmpFile)
// auto orient image based on exif to prevent resize use wrong orientation
pipeline = pipeline.rotate()
pipeline.resize({
width,
height,