fix(post-form): convert HEIC via FilePond beforeAddFile, not a custom uploader (U4)
Runtime verification showed the custom picker uploaded to Grav's flash but never attached photos to the entry — attachment needs FilePond's exact (undocumented) submit contract. Reverting to type:filepond and hooking its beforeAddFile: a HEIC item is rejected, converted to JPEG via the lazy heic-to chunk, then re-added with pond.addFile() so FilePond owns upload + page-attach (the proven path). Web-format photos pass through; conversion failures fail closed (inline status, original never added). Removes the custom photos field template + AJAX uploader. Verified end-to-end in a browser: HEIC posts as JPEG, corrupt HEIC is skipped, Submit gated while converting, draft photos-reselect hint intact. Refs R8, R9, R16, R17, AE1, AE4, KTD4.
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
{#
|
||||
Custom `photos` form field — a plain, controlled picker that replaces Grav's
|
||||
managed filepond/dropzone field on /post so post-form.js can convert HEIC
|
||||
before upload (see U4). It carries the same destination/accept/limit settings
|
||||
the server's uploadFiles() reads via the blueprint, but renders its own input
|
||||
and uploads through post-form.js, not FilePond.
|
||||
#}
|
||||
{% extends "forms/field.html.twig" %}
|
||||
|
||||
{% block input %}
|
||||
{% set files = config.plugins.form.files|merge(field|default([])) %}
|
||||
{% set limit = not field.multiple ? 1 : (field.limit ?? files.limit ?? 4) %}
|
||||
<div class="photo-picker {{ field.classes }}"
|
||||
data-file-field-name="{{ field.name }}"
|
||||
data-file-url-add="{{ form.getFileUploadAjaxRoute().getUri()|e('html_attr') }}"
|
||||
data-limit="{{ limit }}">
|
||||
<label class="photo-picker__add btn-action">
|
||||
<span class="photo-picker__add-label">📷 Add photos</span>
|
||||
<input type="file"
|
||||
class="photo-picker__input"
|
||||
accept="image/*,.heic,.heif,.HEIC,.HEIF"
|
||||
{% if field.multiple %}multiple="multiple"{% endif %}
|
||||
hidden />
|
||||
</label>
|
||||
<ul class="photo-picker__list" aria-live="polite"></ul>
|
||||
<p class="photo-picker__hint form-status" role="status"></p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user