Images as a record field (drag/drop, paste, import) #10

Closed
opened 2026-11-09 19:15:20 +00:00 by eric · 1 comment
Owner

Store PNG and JPEG images inside any record, as another field type next to the text fields, with the same mechanics (label, secret flag, reorder, delete).

Decisions

  • Record fields only (steps/checklist items are unchanged).
  • Imported images are downscaled (long side <= 1600 px) and re-encoded, which also strips camera metadata such as GPS. PNG stays PNG when small, otherwise JPEG.
  • Images live in the document JSON as data URLs, so they are encrypted with everything else.

Ways to add an image (edit mode)

  • Choose file(s) with + Add image... (several at once = several fields)
  • Drag and drop onto a record (new field) or onto an existing image field (replace)
  • Paste from the clipboard while focus is in a record (new field) or in an image field (replace)

Behavior

  • Only PNG/JPEG accepted (checked by file signature, not just name); clear error otherwise
  • Per-image size shown; secret flag hides the image behind Show/Hide in the viewer and is withheld in a masked print
  • Click an image to enlarge
  • Dropping a file on the page never navigates away from unsaved work
  • Print: images sized to fit the page and not split; wait for decode before printing
  • Model validation rejects non-PNG/JPEG data URLs and oversized values
  • Docs updated
Store PNG and JPEG images inside any record, as another field type next to the text fields, with the same mechanics (label, secret flag, reorder, delete). **Decisions** - Record fields only (steps/checklist items are unchanged). - Imported images are downscaled (long side <= 1600 px) and re-encoded, which also strips camera metadata such as GPS. PNG stays PNG when small, otherwise JPEG. - Images live in the document JSON as data URLs, so they are encrypted with everything else. **Ways to add an image (edit mode)** - [ ] Choose file(s) with `+ Add image...` (several at once = several fields) - [ ] Drag and drop onto a record (new field) or onto an existing image field (replace) - [ ] Paste from the clipboard while focus is in a record (new field) or in an image field (replace) **Behavior** - [ ] Only PNG/JPEG accepted (checked by file signature, not just name); clear error otherwise - [ ] Per-image size shown; secret flag hides the image behind Show/Hide in the viewer and is withheld in a masked print - [ ] Click an image to enlarge - [ ] Dropping a file on the page never navigates away from unsaved work - [ ] Print: images sized to fit the page and not split; wait for decode before printing - [ ] Model validation rejects non-PNG/JPEG data URLs and oversized values - [ ] Docs updated
eric closed this issue 2026-11-09 21:01:26 +00:00
Author
Owner

Implemented in f5f05a3.

Added

  • Image field type on records: import (file picker, multi-select), drag and drop (new field, or replace on an existing image box), and clipboard paste (new field, or replace when an image box is focused).
  • Same mechanics as other fields: label, secret checkbox, reorder, delete. Click to enlarge; secret images stay hidden until Show and print as [withheld] when masked.
  • PNG/JPEG only, identified by file signature. Images are downscaled (long side <= 1600 px) and re-encoded, which strips metadata. Hard limit about 3 MB per image.
  • Stored inside the encrypted document under the same passphrase. Stray file drops outside a drop target no longer navigate away.
  • Print: images decoded before the dialog opens and capped at 4.2 in tall.

Verified (headless Chromium): all import/drop/paste routes, rejection of disguised GIF and text files, 7.8 MB PNG reduced to a ~1.1 MB JPEG, EXIF removal, save/decrypt round-trip of 7 images with no plaintext image bytes in the file, and a real PDF print. Unit tests: 34 pass, 1 skipped (needs data/seed.json).

Not verified: Firefox and Safari paste/drop, and use on real data or a real thumbdrive. HEIC, GIF and WebP are refused by design. Steps and checklist items do not take images.

Implemented in f5f05a3. **Added** - Image field type on records: import (file picker, multi-select), drag and drop (new field, or replace on an existing image box), and clipboard paste (new field, or replace when an image box is focused). - Same mechanics as other fields: label, secret checkbox, reorder, delete. Click to enlarge; secret images stay hidden until Show and print as [withheld] when masked. - PNG/JPEG only, identified by file signature. Images are downscaled (long side <= 1600 px) and re-encoded, which strips metadata. Hard limit about 3 MB per image. - Stored inside the encrypted document under the same passphrase. Stray file drops outside a drop target no longer navigate away. - Print: images decoded before the dialog opens and capped at 4.2 in tall. **Verified** (headless Chromium): all import/drop/paste routes, rejection of disguised GIF and text files, 7.8 MB PNG reduced to a ~1.1 MB JPEG, EXIF removal, save/decrypt round-trip of 7 images with no plaintext image bytes in the file, and a real PDF print. Unit tests: 34 pass, 1 skipped (needs data/seed.json). **Not verified**: Firefox and Safari paste/drop, and use on real data or a real thumbdrive. HEIC, GIF and WebP are refused by design. Steps and checklist items do not take images.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: eric/final-wishes#10
No description provided.