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.

Props joemcgill.
Fixes #35108 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@36110 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2015-12-28 02:28:53 +00:00
parent ba1f056a26
commit 9b9d310c74
2 changed files with 54 additions and 3 deletions
+7 -2
View File
@@ -1046,8 +1046,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;
}