Skip to content

fix: apply EXIF orientation during thumbnail generation#3521

Draft
unofn with Copilot wants to merge 2 commits into
developfrom
copilot/fix-thumbnail-exif-orientation
Draft

fix: apply EXIF orientation during thumbnail generation#3521
unofn with Copilot wants to merge 2 commits into
developfrom
copilot/fix-thumbnail-exif-orientation

Conversation

Copilot AI commented Jul 8, 2026

Copy link
Copy Markdown

Thumbnails generated for smartphone photos ignore the EXIF Orientation tag, causing images to appear rotated 90° in Gallery View and attachment previews.

Add .rotate() (no-arg, EXIF-based auto-rotation) to the sharp pipeline before .resize() in all four thumbnail generation paths:

  • attachments-storage.service.ts — buffer-based thumbnail upload path
  • plugins/local.ts — local storage cropImage
  • plugins/minio.ts — MinIO storage cropImage
  • plugins/s3.ts — S3 storage cropImage
// Before
sharp(input, { failOn: 'none', unlimited: true }).resize(width, height);

// After
sharp(input, { failOn: 'none', unlimited: true }).rotate().resize(width, height);

Sharp's .rotate() without arguments reads the EXIF Orientation tag and applies the corresponding transformation to pixel data before any subsequent operations.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

…otate()

Add .rotate() before .resize() in all thumbnail generation paths so that
EXIF Orientation metadata is respected. This fixes rotated thumbnails for
smartphone photos in Gallery View and attachment previews.

Closes #2854
Copilot AI changed the title [WIP] Fix thumbnail generation to respect EXIF Orientation tag fix: apply EXIF orientation during thumbnail generation Jul 8, 2026
Copilot finished work on behalf of unofn July 8, 2026 06:48
Copilot AI requested a review from unofn July 8, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Thumbnail generation does not respect EXIF Orientation tag

3 participants