mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-21 01:53:41 +08:00
## Summary - Extends client-side image optimization to convert **JXL → JPEG**, **HEIC → JPEG**, and **animated GIF → animated WEBP** using jSquash WASM packages before upload - Transparent JXL/HEIC images are converted to **WEBP** instead of JPEG, so transparency is preserved (WEBP compresses much better than PNG for this case) - Gated as an **upcoming change** via `composer_media_optimization_image_convert_enabled` (experimental, `feature,all_members`, opt-in per group through the upcoming changes admin UI) - Sends raw file bytes to Web Worker for formats browsers can't decode natively (JXL, HEIC), with new `"convert"` and `"convertAnimated"` worker message types - Adds JXL to `authorized_extensions` and `supported_images`; adds HEIC/HEIF to `supported_images` for consistency - Skips GIF→WEBP when output is larger than input - Falls back to filename when MIME type is missing (browsers may not recognize JXL/HEIC) ### Note on jSquash packages This depends on Discourse-scoped forks of the jSquash packages (`@discourse/jxl`, `@discourse/heic`, `@discourse/webp`, `@discourse/gif`, `@discourse/jpeg`, `@discourse/resize`). The following upstream PRs would let us move back to the canonical `@jsquash/*` packages, but the upstream maintainer is currently unresponsive: - https://github.com/jamsinclair/jSquash/pull/101 (`@jsquash/heic`) - https://github.com/jamsinclair/jSquash/pull/103 (`@jsquash/webp` animated support) - https://github.com/jamsinclair/jSquash/pull/104 (`@jsquash/gif`) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| count.js | ||
| embed-topics.js | ||
| embed.js | ||
| media-optimization-worker.js | ||