mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-24 15:38:10 +02:00
Fix: Pre-process Facebook story images with sharp to correct EXIF orientation
This commit is contained in:
1 parent
509e36a05e
commit
4b779838b3
1 file changed
+6
-1
@@ -125,10 +125,15 @@ export class ImageProcessor {
|
|||||||
// Remove hashtags from text while keeping emojis
|
// Remove hashtags from text while keeping emojis
|
||||||
const cleanText = removeHashtags(text);
|
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 canvas = createCanvas(STORY_WIDTH, STORY_HEIGHT);
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
const image = await loadImage(imageUrl);
|
const image = await loadImage(rotationBuffer);
|
||||||
|
|
||||||
const imgWidth = image.width;
|
const imgWidth = image.width;
|
||||||
const imgHeight = image.height;
|
const imgHeight = image.height;
|
||||||
|
|||||||
Reference in new issue
Block a user