Repository navigation
Media: Generate animated image sub-sizes by default. - #12572
adamsilverstein wants to merge 14 commits into
Conversation
… index. Sub-sizes of animated images are static first-frame images by default because re-encoding every frame per sub-size is very resource intensive. The client-side media processing path can preserve animation in the browser, so expose an opt-in flag on the REST API index (alongside image_size_threshold) that the client pipeline honors for uncropped sub-sizes. See WordPress/gutenberg#80383 and WordPress/gutenberg#80385.
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Just noting we have decided to land this in 7.2. |
…ubsizes-filter # Conflicts: # src/wp-includes/rest-api/class-wp-rest-server.php # tests/phpunit/tests/rest-api/rest-server.php # tests/qunit/fixtures/wp-api-generated.js
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DxbbMKz3sa741SjHuE1ZLS
A bare `animated_image_subsizes` reads like an array of sizes rather than a boolean. Prefix it with `generate_` so the field name mirrors the filter it exposes, and keep the preload field lists alphabetical so they still match the editor's entities.js list exactly. Claude-Session: https://claude.ai/code/session_018uRsBsDb9t3piAjyWaycCo
t-hamano
left a comment
There was a problem hiding this comment.
Pre-approving this prior to WordPress/gutenberg#80385.
Just in case, it might be better to wait to commit this PR until WordPress/gutenberg#80385 is merged and confirmed to be shipped in 7.2. Otherwise, a mismatch may occur between the preload list and entities.js.
|
Looks good. Clean opt-in approach for preserving animated GIF sub-sizes via the client-side pipeline. Happy to test once both sides are ready. |
This is ready for testing @mahdialikhanusiya |
Missing animation in sub-sizes has been reported as a bug since #28474, so keep it by default, cropped sizes included, and let sites opt out with the `wp_generate_animated_image_subsizes` filter instead. Mirrors WordPress/gutenberg#80385. Claude-Session: https://claude.ai/code/session_01NyQHifJCe7BYvWvpPDtwXG
|
@adamsilverstein Thanks I will test it soon. Hopefully by tomorrow. |
WordPress/gutenberg#80385 is merged and I plan to merge this PR ahead of beta 1. |
|
Tested on the Playground. Uploaded an animated GIF via the block editor.
Also tested after changing the resolution in the block editor — sub-sizes still remained static. Looks like the client-side path may not be generating animated sub-sizes in this environment. Let me know if additional testing steps are needed. |
|
@mahdialikhanusiya thanks for testing! Claude dug into why the sub-sizes came out static, here is what it found:
|
|
@adamsilverstein Thanks for the clear explanation! 🙌 |
Updated to match the change of direction in WordPress/gutenberg#80385 (comment): animated sub-sizes are now the default, and the filter is an opt-out.
Claude rewrote the description to follow along:
Trac ticket: https://core.trac.wordpress.org/ticket/65656
Trac ticket: https://core.trac.wordpress.org/ticket/28474
Proposed commit message
AI Use
The code and this description came out of a session with 🤖 Claude Code. I will review and test.