fix: auto-rotate images based on EXIF orientation for Facebook stories

This commit is contained in:
Michael committed 2026-01-12 13:50:28 +01:00
1 parent 6c299b954a
commit 509e36a05e
1 file changed
+3
+3
View File
@@ -62,6 +62,7 @@ export class ImageProcessor {
const fbFeedFilename = `${baseId}-fb-feed${fileExt}`; const fbFeedFilename = `${baseId}-fb-feed${fileExt}`;
const fbFeedPath = path.join(this.uploadsDir, fbFeedFilename); const fbFeedPath = path.join(this.uploadsDir, fbFeedFilename);
await sharp(buffer) await sharp(buffer)
.rotate() // Auto-rotate based on EXIF orientation
.resize(CROP_FORMATS.facebookFeed.width, CROP_FORMATS.facebookFeed.height, { .resize(CROP_FORMATS.facebookFeed.width, CROP_FORMATS.facebookFeed.height, {
fit: "cover", fit: "cover",
position: "center", position: "center",
@@ -73,6 +74,7 @@ export class ImageProcessor {
const igFeedFilename = `${baseId}-ig-feed${fileExt}`; const igFeedFilename = `${baseId}-ig-feed${fileExt}`;
const igFeedPath = path.join(this.uploadsDir, igFeedFilename); const igFeedPath = path.join(this.uploadsDir, igFeedFilename);
await sharp(buffer) await sharp(buffer)
.rotate() // Auto-rotate based on EXIF orientation
.resize(CROP_FORMATS.instagramFeed.width, CROP_FORMATS.instagramFeed.height, { .resize(CROP_FORMATS.instagramFeed.width, CROP_FORMATS.instagramFeed.height, {
fit: "cover", fit: "cover",
position: "center", position: "center",
@@ -84,6 +86,7 @@ export class ImageProcessor {
const igStoryFilename = `${baseId}-ig-story${fileExt}`; const igStoryFilename = `${baseId}-ig-story${fileExt}`;
const igStoryPath = path.join(this.uploadsDir, igStoryFilename); const igStoryPath = path.join(this.uploadsDir, igStoryFilename);
await sharp(buffer) await sharp(buffer)
.rotate() // Auto-rotate based on EXIF orientation
.resize(CROP_FORMATS.instagramStory.width, CROP_FORMATS.instagramStory.height, { .resize(CROP_FORMATS.instagramStory.width, CROP_FORMATS.instagramStory.height, {
fit: "cover", fit: "cover",
position: "center", position: "center",