Fix: Pre-process Facebook story images with sharp to correct EXIF orientation

This commit is contained in:
Michael committed 2026-01-14 09:34:42 +01:00
1 parent 509e36a05e
commit 4b779838b3
1 file changed
+6 -1
+6 -1
View File
@@ -125,10 +125,15 @@ export class ImageProcessor {
// Remove hashtags from text while keeping emojis
const cleanText = removeHashtags(text);
// Pre-process image with sharp to apply rotation
const rotationBuffer = await sharp(imageUrl)
.rotate() // Apply EXIF rotation
.toBuffer();
const canvas = createCanvas(STORY_WIDTH, STORY_HEIGHT);
const ctx = canvas.getContext('2d');
const image = await loadImage(imageUrl);
const image = await loadImage(rotationBuffer);
const imgWidth = image.width;
const imgHeight = image.height;