Previously an image at/over the upload size limit was simply rejected with
"File too large", and the limit was hardcoded to 50 MB in the client even when
the server was configured lower. Now:
- The configured image limit (upload.max_size_mb) is surfaced to the client via
pageData.UploadMaxMB and passed to GlimmerUpload.init({maxImageMB}).
- Selecting an over-limit image prompts to compress it in the browser to fit;
the oversized original is never uploaded (Cancel aborts). Images over 10 MB
but under the limit get an optional "compress for faster upload" prompt.
- compressToTarget iteratively fits the file just under the limit: it tries a
JPEG quality ladder (0.85 → 0.4) at each resolution and halves the resolution
on failure, down to a 320 px floor, targeting 95% of the limit for headroom.
If it can't get under the limit it reports the smallest size achieved and
uploads nothing.
Co-Authored-By: Claude Opus 4.8 <[email protected]>