Responsive images: do not generate `srcset` for GIFs that are inserted at full size. Prevents breaking animated GIFs.

Props joemcgill.
Fixes #34528.
Built from https://develop.svn.wordpress.org/trunk@35524


git-svn-id: http://core.svn.wordpress.org/trunk@35488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2015-11-04 21:44:25 +00:00
parent 3c0ed4295e
commit 09c16cb4ac
2 changed files with 8 additions and 1 deletions

View File

@ -983,6 +983,13 @@ function wp_calculate_image_srcset( $image_src, $size_array, $image_meta, $attac
return false; return false;
} }
// Don't add srcset attributes to (animated) gifs that are inserted at full size.
if ( isset( $image_sizes['thumbnail']['mime-type'] ) && 'image/gif' === $image_sizes['thumbnail']['mime-type'] &&
false !== strpos( $image_src, $image_meta['file'] ) ) {
return false;
}
$image_basename = wp_basename( $image_meta['file'] ); $image_basename = wp_basename( $image_meta['file'] );
$image_baseurl = _wp_upload_dir_baseurl(); $image_baseurl = _wp_upload_dir_baseurl();

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-beta2-35523'; $wp_version = '4.4-beta2-35524';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.