Attachment previews: sandboxed thumbnails + metadata (P1–P6) #865

Open
opened 2026-11-02 14:20:24 +00:00 by kayg · 1 comment
Owner

Decisions (kayg, 2026-11-02), extends F6/PH21:

  • P1 server makes previews in a sandbox: pdfium (PDF first page), ffmpeg (video poster + duration), libvips (images, HEIC), text/code/markdown first lines rendered.
  • P2 right after upload, in the background. Until ready, the card shows a pretty generic icon for the file type (an icon set for the most used types), same size/shape, then fades to the thumbnail. No "processing" text.
  • P3 previews live in app data (derivable, not backed up as content); devices cache them for notes they hold offline.
  • P4 two WebP sizes, ~320 px and ~1280 px. PDFs: first page; the viewer opens the real PDF.
  • P5 also extract page count, durations and image dimensions (fixes the first-view text jump in #846).
  • P6 build after BM8: plan first (sizes, big-O, failure table, sandbox design), one backend PR, then file/video cards in the pictures port (#846).
Decisions (kayg, 2026-11-02), extends F6/PH21: - P1 server makes previews in a sandbox: pdfium (PDF first page), ffmpeg (video poster + duration), libvips (images, HEIC), text/code/markdown first lines rendered. - P2 right after upload, in the background. Until ready, the card shows a pretty generic icon for the file type (an icon set for the most used types), same size/shape, then fades to the thumbnail. No "processing" text. - P3 previews live in app data (derivable, not backed up as content); devices cache them for notes they hold offline. - P4 two WebP sizes, ~320 px and ~1280 px. PDFs: first page; the viewer opens the real PDF. - P5 also extract page count, durations and image dimensions (fixes the first-view text jump in #846). - P6 build after BM8: plan first (sizes, big-O, failure table, sandbox design), one backend PR, then file/video cards in the pictures port (#846).
Author
Owner

File-type icons: first design, in the mockup (preview 9ad9f665)

Review link: https://preview.calternal.cloud/calendar-2/chrome.html#/ai/filetypes (light/dark follow the system; add &theme=dark). Details and the matching alignment/shot comments: #839 (comment)

  • Families: PDF, Word/Pages, Excel/Numbers/CSV, PowerPoint/Keynote, text/Markdown, code, archive, audio, video, image, anything else. One colour each (warm, calm: PDF #c0503f, document #4c78b8, spreadsheet #3f8f62, slides #c9742a, text #8a7f74, code #2f8f8a, archive #9a7b4f, audio #b85a85, video #5b5bc0, image #3b8bbd, other #9a9086).
  • Shape: one flat rounded plate tinted with the colour, a 1.6 px line glyph in the same colour, the type word under it when the slot is big. Same size and shape as the thumbnail it stands in for (the PDF card's portrait first-page slot; the row card's 40 px tile).
  • Code: components/embeds/FileGlyph.svelte, lib/embeds/families.ts, used by FileRow.svelte and Doc.svelte. The PDF card with a real first-page preview is unchanged. The server-side preview work (BM8 then the pictures port) just swaps the plate for the real thumbnail where one exists.

file icons

file cards in a reply

**File-type icons: first design, in the mockup (preview `9ad9f665`)** Review link: https://preview.calternal.cloud/calendar-2/chrome.html#/ai/filetypes (light/dark follow the system; add `&theme=dark`). Details and the matching alignment/shot comments: https://git.kayg.org/kayg/calternal/issues/839#issuecomment-75112 - Families: PDF, Word/Pages, Excel/Numbers/CSV, PowerPoint/Keynote, text/Markdown, code, archive, audio, video, image, anything else. One colour each (warm, calm: PDF `#c0503f`, document `#4c78b8`, spreadsheet `#3f8f62`, slides `#c9742a`, text `#8a7f74`, code `#2f8f8a`, archive `#9a7b4f`, audio `#b85a85`, video `#5b5bc0`, image `#3b8bbd`, other `#9a9086`). - Shape: one flat rounded plate tinted with the colour, a 1.6 px line glyph in the same colour, the type word under it when the slot is big. Same size and shape as the thumbnail it stands in for (the PDF card's portrait first-page slot; the row card's 40 px tile). - Code: `components/embeds/FileGlyph.svelte`, `lib/embeds/families.ts`, used by `FileRow.svelte` and `Doc.svelte`. The PDF card with a real first-page preview is unchanged. The server-side preview work (BM8 then the pictures port) just swaps the plate for the real thumbnail where one exists. ![file icons](https://git.kayg.org/attachments/bfefb3b4-24fa-4aa1-af2f-b0c6a130221f) ![file cards in a reply](https://git.kayg.org/attachments/1335a85e-cdfb-49f8-8f9f-d0cc2bad9524)
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
kayg/calternal#865
No description provided.