Use original image for srcset when it is small (#474)
This commit is contained in:
parent
5d67e35f24
commit
2be8e6ba2a
@ -1,3 +1,9 @@
|
||||
* Make it possible for plugins to let the core skip the check
|
||||
whether trackbacks are already sent, with
|
||||
$serendipity['skip_trackback_check']
|
||||
* Add the original image to the response images srcset when
|
||||
the original image is small, to avoid upscaling
|
||||
|
||||
Version 2.4-alpha1 ()
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
@ -216,6 +216,12 @@ class serendipity_event_responsiveimages extends serendipity_event
|
||||
$srcset .= "{$thumbnailHttp} {$breakpoint}w,";
|
||||
}
|
||||
}
|
||||
// 2 == there is the original thumbnail without a dimension, and one thumbnail for the smallest breakpoint
|
||||
if (count($thumbnails) == 2) {
|
||||
// When the smallest thumbnail is the only responsive thumbnail our original image will be needed to as part of the srcset, otherwise we too often upscale the small thumbnail
|
||||
$srcset .= "$imagePath {$origImage['dimensions_width']}w,";
|
||||
}
|
||||
|
||||
if (substr($srcset, -strlen(',')) === ',') {
|
||||
// we don't want to have the trailing comma
|
||||
$srcset = substr($srcset, 0, -1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user