Skip to content

Implement image optimization with thumbnails and WebP#168

Merged
kargig merged 1 commit intomainfrom
feature/image_thumbnails
Jan 17, 2026
Merged

Implement image optimization with thumbnails and WebP#168
kargig merged 1 commit intomainfrom
feature/image_thumbnails

Conversation

@kargig
Copy link
Owner

@kargig kargig commented Jan 17, 2026

  • Added Pillow and python-magic for secure image processing.
  • Installed libmagic1 system dependency in backend/Dockerfile.
  • Created ImageProcessingService to validate, sanitize (strip EXIF), and generate optimized WebP variants (Medium, Thumbnail).
  • Updated R2StorageService to handle uploading sets of image variants.
  • Updated R2StorageService to generate signed URLs with Content-Disposition: attachment for downloads.
  • Updated DiveSite and Dive routers to integrate image processing and expose download_url.
  • Added medium_url and thumbnail_url columns to media tables via Alembic migration 0062.
  • Updated Frontend (DiveSites.js, DiveSiteDetail.js) to use optimized thumbnails, lazy loading, and added a Download button to the Lightbox.
  • Fixed Frontend (EditDiveSite.js, EditDive.js, CreateDive.js) to correctly save medium_url and thumbnail_url and provide granular "Uploading..." feedback during submission.
  • Improved frontend error handling to show detailed error messages (e.g. 413 File Too Large) during upload.
  • Added backend/scripts/generate_thumbnails.py for backfilling existing media.
  • Updated Nginx configuration (dev.conf, prod.conf) to allow 10MB uploads and return JSON errors for 413.
  • Documented the architecture and implementation status in docs/development/work/image_optimization_plan.md.

- Added `Pillow` and `python-magic` for secure image processing.
- Installed `libmagic1` system dependency in `backend/Dockerfile`.
- Created `ImageProcessingService` to validate, sanitize (strip EXIF), and generate optimized WebP variants (Medium, Thumbnail).
- Updated `R2StorageService` to handle uploading sets of image variants.
- Updated `R2StorageService` to generate signed URLs with `Content-Disposition: attachment` for downloads.
- Updated `DiveSite` and `Dive` routers to integrate image processing and expose `download_url`.
- Added `medium_url` and `thumbnail_url` columns to media tables via Alembic migration `0062`.
- Updated Frontend (`DiveSites.js`, `DiveSiteDetail.js`) to use optimized thumbnails, lazy loading, and added a Download button to the Lightbox.
- Fixed Frontend (`EditDiveSite.js`, `EditDive.js`, `CreateDive.js`) to correctly save `medium_url` and `thumbnail_url` and provide granular "Uploading..." feedback during submission.
- Improved frontend error handling to show detailed error messages (e.g. 413 File Too Large) during upload.
- Added `backend/scripts/generate_thumbnails.py` for backfilling existing media.
- Updated Nginx configuration (`dev.conf`, `prod.conf`) to allow 20MB uploads and return JSON errors for 413.
- Documented the architecture and implementation status in `docs/development/work/image_optimization_plan.md`.
@kargig kargig force-pushed the feature/image_thumbnails branch from 487c2ac to a065922 Compare January 17, 2026 13:08
@kargig kargig merged commit 42fe9e1 into main Jan 17, 2026
2 checks passed
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.

1 participant