[2.x] feat: convert uploaded avatars to WebP, add batch migration command#4431
Merged
[2.x] feat: convert uploaded avatars to WebP, add batch migration command#4431
Conversation
- AvatarUploader: encode static images as WebP instead of PNG; animated GIFs unchanged - AvatarValidator: accept WebP as a valid upload format - AvatarEditor: use MIME types in file picker accept attribute (includes image/webp) - Add `avatars:convert-to-webp` CLI command to batch-convert existing local avatars - Add unit test asserting new uploads produce a .webp path Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Mar 12, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AvatarUploadernow encodes all static image uploads as.webpinstead of.png. Animated GIFs are preserved as-is.AvatarValidatoraddswebpto the list of accepted MIME types so users can upload WebP files directly.AvatarEditornow uses MIME types in the<input accept>attribute (image/jpeg,image/png,image/gif,image/webp,image/bmp) for better OS-level filtering, replacing the previous extension-based list.php flarum avatars:convert-to-webpCLI command to batch-convert existing local avatars (PNG/JPEG/BMP) to WebP. UseschunkById(100)for memory efficiency, isolates per-user errors, and reports converted/missing/failed counts.test_upload_stores_webp_for_static_images()to assert new uploads produce a.webppath.Test plan
.gif, all others saved as.webpphp flarum avatars:convert-to-webpagainst a forum with existing PNG avatars — verify files are converted and DB updatedphpunit framework/core/tests/unit/User/AvatarUploaderTest.php🤖 Generated with Claude Code