Skip to content

feat(invoice-generator): add client-side image compression#805

Draft
MikaelSiidorow wants to merge 1 commit intomainfrom
compression
Draft

feat(invoice-generator): add client-side image compression#805
MikaelSiidorow wants to merge 1 commit intomainfrom
compression

Conversation

@MikaelSiidorow
Copy link
Collaborator

Summary

  • Add client-side image compression for invoice generator attachments
  • Compress images eagerly when selected (not on submit) with loading indicator
  • Show image preview thumbnails with compression ratio (e.g., "5.2 MB → 412 KB (-92%)")
  • Use browser-image-compression library (lazy-loaded, Web Worker enabled)

This significantly reduces payload sizes for receipt photos, helping avoid rate limiting issues when uploading large images.

Fixes #551

Technical notes

Uses browser-image-compression as a pragmatic choice. The code includes a TODO for upgrading to wasm-vips when browser support for credentialless iframes improves (currently blocks due to Google Forms embeds needing COEP/COOP headers).

Test plan

  • Upload a large iPhone photo as attachment
  • Verify compression spinner appears briefly
  • Verify preview thumbnail displays with size reduction info
  • Verify form submits successfully with compressed images
  • Verify non-image files (PDFs) pass through unchanged

🤖 Generated with Claude Code

Compress image attachments eagerly when selected, before form submission.
This significantly reduces payload size for receipt photos (often 90%+
reduction), helping avoid rate limiting issues with large uploads.

Features:
- Eager compression on file selection with loading spinner
- Image preview thumbnails after compression
- File size display with compression ratio
- Lazy-loaded browser-image-compression library
- Web Worker support for non-blocking compression

Fixes #551

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

Unknown errors when creating invoices

1 participant