Commit 24b70fb4d0 for wordpress.org
commit 24b70fb4d0219ef1b69d77c4c11465a6764d5691
Author: adamsilverstein <adamsilverstein@git.wordpress.org>
Date: Sun Oct 18 22:37:47 2026 +0000
Media: Generate animated image sub-sizes by default.
Fix an issue where sub-sizes of animated image uploads were static first-frame images, as GD and Imagick flatten animated images when resizing. When client-side media processing is active, generated images now retain animations.
Add a `wp_generate_animated_image_subsizes` filter (boolean, default true) so the client pipeline can keep or drop the animation in sub-sizes. The client-side consumption ships via the Gutenberg package updates in https://github.com/WordPress/gutenberg/pull/80385.
Fixes #65656, #28474.
Built from https://develop.svn.wordpress.org/trunk@64490
git-svn-id: http://core.svn.wordpress.org/trunk@63640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-admin/edit-form-blocks.php b/wp-admin/edit-form-blocks.php
index 693919d3d5..820424fb3c 100644
--- a/wp-admin/edit-form-blocks.php
+++ b/wp-admin/edit-form-blocks.php
@@ -94,6 +94,7 @@ $preload_paths = array(
',',
array(
'description',
+ 'generate_animated_image_subsizes',
'gmt_offset',
'home',
'image_max_bit_depth',
diff --git a/wp-admin/site-editor.php b/wp-admin/site-editor.php
index 4289f89f71..076ad053d2 100644
--- a/wp-admin/site-editor.php
+++ b/wp-admin/site-editor.php
@@ -220,6 +220,7 @@ $preload_paths = array(
',',
array(
'description',
+ 'generate_animated_image_subsizes',
'gmt_offset',
'home',
'image_max_bit_depth',
diff --git a/wp-includes/rest-api/class-wp-rest-server.php b/wp-includes/rest-api/class-wp-rest-server.php
index 140e14122d..48eb61f494 100644
--- a/wp-includes/rest-api/class-wp-rest-server.php
+++ b/wp-includes/rest-api/class-wp-rest-server.php
@@ -1463,6 +1463,23 @@ class WP_REST_Server {
*/
/** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */
$available['image_max_bit_depth'] = (int) apply_filters( 'image_max_bit_depth', 16, 16 );
+
+ /**
+ * Filters whether client-side media processing preserves animation in image sub-sizes.
+ *
+ * By default, sub-sizes of animated GIF and WebP images retain animation,
+ * including cropped sizes. Return false to generate static sub-sizes using
+ * only the first frame, reducing processing time in the browser.
+ *
+ * This setting applies only to client-side media processing. Server-side
+ * processing continues to generate static sub-sizes.
+ *
+ * @since 7.2.0
+ *
+ * @param bool $generate_animated_image_subsizes Whether to preserve animation in image sub-sizes.
+ * Default true.
+ */
+ $available['generate_animated_image_subsizes'] = (bool) apply_filters( 'wp_generate_animated_image_subsizes', true );
}
$response = new WP_REST_Response( $available );
diff --git a/wp-includes/version.php b/wp-includes/version.php
index aa2da05963..b9e895e42b 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-alpha-64489';
+$wp_version = '7.2-alpha-64490';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.