CulverLab / CulverLab/sparcd-exploration

Tagger: write a thumbnail sidecar at upload so the grid doesn't load full originals

Open
#201 0 comments 0 reactions 1 assignee Claimed by @Juli4nG View on GitHub
app:tagger app:uploader enhancement
Dominant language
TypeScript
Stars
6
Forks
3
Avg merge
2d 13h
Merged PRs (30d)
106

Description

The tagger grid pulls full 1-5MB originals to draw thumbnails. On a field laptop over a slow link that makes scrolling and zooming painful. The uploader already builds a small JPEG for its Inspect preview and then throws it away.

Where:

- `apps/sparcd-uploader/src/workers/fileProcessor.worker.ts:108-127` builds the thumbnail with `createImageBitmap` and `OffscreenCanvas` at quality 0.7, and returns it in memory only
- `apps/sparcd-tagger/src/components/Thumb.tsx:1-12` says P0 renders the original and the virtualized grid is deferred
- `apps/sparcd-tagger/src/lib/useMediaUrl.ts:36-53` and `apps/sparcd-tagger/src/lib/s3.ts:158` mint the presigned GET
- `packages/camtrap/src/index.ts:250-268` writes `UploadComplete.json`, an additive project-owned file, so a project-owned sidecar has precedent

What to do:

1. Upload the worker's thumbnail alongside the original. I recommend `thumbs/.jpg` under the upload prefix, since it keeps the sidecar inside the same prefix the uploader already writes and lists, but the key convention is a team call.
2. Have the tagger try the sidecar key first and fall back to the original when the GET 404s, so old and new uploads both render.
3. Video keeps its current poster-frame path.

A plain object with a 404 fallback works the same on every S3-compatible provider, which is the main reason to prefer it over anything that leans on provider-side image transforms.

Open question, backfill. Existing uploads have no sidecars and there is no server to generate them. Simplest option: a one-off "generate thumbnails for this collection" action in the tagger that reads originals in the browser and writes sidecars using the connected credential. Slow but needs no new infrastructure.

Done when:

- [ ] Sidecar written per image during upload
- [ ] Grid loads sidecars and falls back to originals
- [ ] Bytes per grid screen drop by an order of magnitude on a real collection
- [ ] Key convention documented in the camtrap package

Related: #196 cross-upload dedupe, #198 meeting notes.

Serves user story: H1, H2, F1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.