feat(thumbnails): 256px proportional, dedicated task, regen endpoint #20

Merged
erik merged 2 commits from feat/thumbnails into main 2026-05-23 04:02:56 +00:00
Member

Refs: #2


Summary

Splits thumbnail derivation out of optimize-photo into its own generate-thumbnail task, switches the size policy to a 256px width cap with proportional height (no square crop), and adds a dedicated POST /api/photos/:id/regenerate-thumbnail endpoint for [re-]generating a single thumbnail. Documented in wiki/thumbnails.md.

Changes

  • src/lib/pois/tasks.ts — new generate-thumbnail task handler. optimize-photo now writes only the optimized variant + width/height then enqueues generate-thumbnail. Thumbnails are sourced from url_optimized (already EXIF-rotated; smaller download), use THUMBNAIL_WIDTH = 256 with proportional height, and withoutEnlargement: true.
  • src/routes/api/photos/[id]/regenerate-thumbnail.ts — new owner-only endpoint that enqueues generate-thumbnail for a single photo and returns 202 with the task id. Mirrors the existing restore-optimized pattern.
  • wiki/thumbnails.md — policy, pipeline, regeneration endpoint, and the rationale for sourcing thumbnails from the optimized variant.

Test plan

  • just validate (fmt, lint, type-check, full test suite + coverage, audit, secrets, sast, fuzz) — green.
  • deno check on touched files.
  • Manual: upload a photo, verify optimize-photo produces the optimized variant and generate-thumbnail produces a 256px-wide thumbnail at the correct path.
  • Manual: POST /api/photos/:id/regenerate-thumbnail as the owner returns 202 + task id; as a non-owner returns 403; unknown id returns 404.
Refs: #2 --- ## Summary Splits thumbnail derivation out of `optimize-photo` into its own `generate-thumbnail` task, switches the size policy to a 256px width cap with proportional height (no square crop), and adds a dedicated `POST /api/photos/:id/regenerate-thumbnail` endpoint for [re-]generating a single thumbnail. Documented in `wiki/thumbnails.md`. ## Changes - `src/lib/pois/tasks.ts` — new `generate-thumbnail` task handler. `optimize-photo` now writes only the optimized variant + width/height then enqueues `generate-thumbnail`. Thumbnails are sourced from `url_optimized` (already EXIF-rotated; smaller download), use `THUMBNAIL_WIDTH = 256` with proportional height, and `withoutEnlargement: true`. - `src/routes/api/photos/[id]/regenerate-thumbnail.ts` — new owner-only endpoint that enqueues `generate-thumbnail` for a single photo and returns `202` with the task id. Mirrors the existing `restore-optimized` pattern. - `wiki/thumbnails.md` — policy, pipeline, regeneration endpoint, and the rationale for sourcing thumbnails from the optimized variant. ## Test plan - [x] `just validate` (fmt, lint, type-check, full test suite + coverage, audit, secrets, sast, fuzz) — green. - [x] `deno check` on touched files. - [ ] Manual: upload a photo, verify `optimize-photo` produces the optimized variant and `generate-thumbnail` produces a 256px-wide thumbnail at the correct path. - [ ] Manual: `POST /api/photos/:id/regenerate-thumbnail` as the owner returns 202 + task id; as a non-owner returns 403; unknown id returns 404.
feat(thumbnails): 256px-wide proportional, dedicated task + regen endpoint
All checks were successful
Validate / validate (pull_request) Successful in 1m3s
e65312c1c7
Split thumbnail derivation out of optimize-photo into its own generate-thumbnail task. Thumbnails are now 256px wide with proportional height (no square crop, no distortion), sourced from the optimized variant so re-running is cheap and inherits EXIF rotation. Adds POST /api/photos/:id/regenerate-thumbnail (owner-only) for [re-]generating a single thumbnail — useful for backfills after a policy change. Documented in wiki/thumbnails.md.
test(thumbnails): cover generate-thumbnail handler and regen endpoint
All checks were successful
Validate / validate (pull_request) Successful in 1m12s
e1ed74234d
Adds src/lib/pois/tasks.test.ts covering the new generate-thumbnail handler: 256px proportional width, withoutEnlargement for narrow sources, legacy-path cleanup, no-op when url_optimized is missing, and the optimize-photo → generate-thumbnail enqueue cascade. Adds the regenerate-thumbnail endpoint to the per-verb owner-only/enqueue assertions in curation-endpoints.test.ts. Fixes a wiki cosmetic (width/height live on photos, not pois).
erik merged commit ceacba7860 into main 2026-05-23 04:02:56 +00:00
erik deleted branch feat/thumbnails 2026-05-23 04:02:56 +00:00
Sign in to join this conversation.
No description provided.