Step images: upload, crop, variants, guarded media route #11

Closed
opened 2026-11-01 16:19:36 +01:00 by miko · 2 comments
Owner

Part of #1

Blocked by: #9

What

Up to three 4:3 images per step. See ADR-0006.

Acceptance criteria

  • Prisma model StepImage (stepId, position, fileKey, originalWidth/Height, crop x/y/w/h)
  • Browser crop UI fixed to 4:3; uploads original + crop rectangle
  • JPEG/PNG/WebP up to 20 MB; server uses sharp: apply EXIF orientation, strip EXIF, crop, generate three WebP variants (thumb, medium, large) synchronously
  • Files in UPLOAD_DIR outside public/, random ids; original kept
  • Storage behind a small interface (read/write/delete)
  • /media/[imageId]/[variant] checks effective visibility via #7; public → Cache-Control: public, immutable, internal → private
  • Max three images per step, reorderable; reading view shows the main image with thumbnails to switch
  • Re-crop possible; it discards the image's annotations after a confirmation

Vocabulary: GLOSSARY.md. Decisions: docs/adr/.

Part of #1 Blocked by: #9 ## What Up to three 4:3 images per step. See ADR-0006. ## Acceptance criteria - [ ] Prisma model `StepImage` (stepId, position, fileKey, originalWidth/Height, crop x/y/w/h) - [ ] Browser crop UI fixed to 4:3; uploads original + crop rectangle - [ ] JPEG/PNG/WebP up to 20 MB; server uses `sharp`: apply EXIF orientation, strip EXIF, crop, generate three WebP variants (thumb, medium, large) synchronously - [ ] Files in `UPLOAD_DIR` outside `public/`, random ids; original kept - [ ] Storage behind a small interface (read/write/delete) - [ ] `/media/[imageId]/[variant]` checks effective visibility via #7; public → `Cache-Control: public, immutable`, internal → `private` - [ ] Max three images per step, reorderable; reading view shows the main image with thumbnails to switch - [ ] Re-crop possible; it discards the image's annotations after a confirmation Vocabulary: `GLOSSARY.md`. Decisions: `docs/adr/`.
Author
Owner

Handed over from #10: the reading view currently shows a step's lines above its content (src/steps/components/GuideSteps.tsx). With step images, add the iFixit layout there: image area on the left, step lines on the right, content below.

Handed over from #10: the reading view currently shows a step's lines above its content (src/steps/components/GuideSteps.tsx). With step images, add the iFixit layout there: image area on the left, step lines on the right, content below.
Author
Owner

Implemented in #25 (feature/11-step-images): StepImage model, 4:3 crop UI, sharp variants, UPLOAD_DIR storage behind an interface, guarded /media route with visibility-based caching, reorder/re-crop/delete, iFixit layout in the reading view. ADR-0006 updated.

Implemented in #25 (feature/11-step-images): StepImage model, 4:3 crop UI, sharp variants, UPLOAD_DIR storage behind an interface, guarded /media route with visibility-based caching, reorder/re-crop/delete, iFixit layout in the reading view. ADR-0006 updated.
miko closed this issue 2026-11-02 09:56:08 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MassiveDynamic/kataba#11
No description provided.