feat(post-form): client-side HEIC->JPEG photo picker (U4)

Replace /post's managed filepond field with a controlled 'photos' field
(theme forms/fields/photos) + picker logic in post-form.js: magic-byte
sniff (ISO-BMFF ftyp brands, not filename/MIME), lazy import('heic-to')
only for real HEIC (deferred 3MB chunk via ESM splitting), per-thumbnail
converting/uploading/done/error states, in-flight counter gating Submit,
and fail-closed skip on conversion failure. Converted JPEGs POST to Grav's
AJAX file-upload route into the form flash (the only path copyFiles reads),
so add-page-by-form attaches them on submit. Web-format photos pass through.

Refs R8, R9, R16, R17, AE1, AE4, KTD4.
This commit is contained in:
2026-07-04 16:38:13 +02:00
parent 6282528dd8
commit bf5b5c2f3c
10 changed files with 318 additions and 66 deletions
+5 -1
View File
@@ -47,7 +47,11 @@ form:
-
name: photos
label: Photos (max 4)
type: filepond
# Custom controlled picker (theme: forms/fields/photos) — replaces
# filepond so post-form.js can convert HEIC before upload (U4). The
# destination/accept/limit below are still read server-side by the
# form's AJAX uploadFiles() handler.
type: photos
multiple: true
destination: '@self'
limit: 4