Skip to content

Scale gallery-uploaded images to match camera captures (max 1280px) #9

Merged
JustCreature merged 6 commits into
mainfrom
F-3
Feb 19, 2026
Merged

Scale gallery-uploaded images to match camera captures (max 1280px) #9
JustCreature merged 6 commits into
mainfrom
F-3

Conversation

@JustCreature

Copy link
Copy Markdown
Owner

Implements consistent image scaling for all uploaded images to prevent storage bloat and performance issues.

Problem

Gallery uploads were stored at full resolution (4000px+) while camera captures were automatically scaled to 1280px, causing:

  • Inconsistent image sizes within film rolls
  • Excessive storage usage for uploaded images
  • Slower performance when displaying/exporting large images

Solution

  • Added fileUtils.scaleImageFile() utility function in src/utils/camera.ts:184-256
  • Uses same scaling logic as camera captures: max 1280px, JPEG quality 0.7-0.8
  • Updated gallery upload in CameraScreen.tsx:277 to use new scaling function
  • Updated image replacement in DetailsScreen.tsx:90 to use new scaling function

Benefits

  • ✅ Consistent 1280px max size for all images (camera + gallery)
  • ✅ ~60-80% reduction in storage for typical uploads
  • ✅ Faster image loading and export performance
  • ✅ Backward compatible (existing images unchanged)

Testing

  • Added comprehensive Playwright test suite (e2e/image-upload.spec.ts)
  • 4 test cases × 5 browsers = 20 new tests
  • Tests verify gallery upload, multiple uploads, image replacement, and large image handling
  • Updated CLAUDE.md with testing requirements for future features

Files Changed

  • src/utils/camera.ts (+73 lines)
  • src/components/CameraScreen.tsx (1 line)
  • src/components/DetailsScreen.tsx (1 line)
  • e2e/image-upload.spec.ts (+170 lines, new)
  • CLAUDE.md (+13 lines)

@JustCreature JustCreature self-assigned this Feb 19, 2026
@JustCreature JustCreature added documentation Improvements or additions to documentation enhancement New feature or request labels Feb 19, 2026
@JustCreature JustCreature changed the base branch from main to F-2 February 19, 2026 14:00
Base automatically changed from F-2 to main February 19, 2026 15:01
@JustCreature JustCreature marked this pull request as draft February 19, 2026 15:02
@JustCreature JustCreature marked this pull request as ready for review February 19, 2026 15:02
@JustCreature JustCreature merged commit 93d9bc1 into main Feb 19, 2026
2 checks passed
@JustCreature JustCreature deleted the F-3 branch February 19, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant