From b2da9c0fd41b09d23cf2886ba9cb6645cabc9b4d Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sat, 2 Jan 2016 03:53:22 +0000 Subject: [PATCH] Responsive Images: when creating `srcset` do not exclude the image size which is in the src attribute even when it is larger than `max_srcset_image_width`. Merges [36110] to the 4.4 branch. Props joemcgill. Fixes #35108. Built from https://develop.svn.wordpress.org/branches/4.4@36150 git-svn-id: http://core.svn.wordpress.org/branches/4.4@36116 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/media.php | 9 +++++++-- wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/wp-includes/media.php b/wp-includes/media.php index e6c27b0c85..872db2c6ea 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -1049,8 +1049,13 @@ function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attac continue; } - // Filter out images that are wider than '$max_srcset_image_width'. - if ( $max_srcset_image_width && $image['width'] > $max_srcset_image_width ) { + /* + * Filter out images that are wider than '$max_srcset_image_width' unless + * that file is in the 'src' attribute. + */ + if ( $max_srcset_image_width && $image['width'] > $max_srcset_image_width && + false === strpos( $image_src, $image['file'] ) ) { + continue; } diff --git a/wp-includes/version.php b/wp-includes/version.php index a167ef2533..3a34249961 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4.1-alpha-36149'; +$wp_version = '4.4.1-alpha-36150'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.