Twenty Seventeen: Resolves Header Image Quality Issue

The heading image had quality issues on iOS Safari in portrait and landscape modes. This resolves it through adding 200cv for smaller screens so less than full size.

Props poena, richardevs, laurelfulford, davidakennedy, joemcgill, SergeyBiryukov, ianbelanger, sabernhardt, shailu25, robertghetau.
Fixes #39253.


git-svn-id: https://develop.svn.wordpress.org/trunk@58135 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
karmatosed 2024-05-12 09:27:02 +00:00
parent ea8bc973b4
commit 9a90425710

View File

@ -580,6 +580,7 @@ add_filter( 'wp_calculate_image_sizes', 'twentyseventeen_content_image_sizes_att
* Filters the `sizes` value in the header image markup.
*
* @since Twenty Seventeen 1.0
* @since Twenty Seventeen 3.7 Added larger image size for small screens.
*
* @param string $html The HTML image tag markup being filtered.
* @param object $header The custom header object returned by 'get_custom_header()'.
@ -588,7 +589,7 @@ add_filter( 'wp_calculate_image_sizes', 'twentyseventeen_content_image_sizes_att
*/
function twentyseventeen_header_image_tag( $html, $header, $attr ) {
if ( isset( $attr['sizes'] ) ) {
$html = str_replace( $attr['sizes'], '100vw', $html );
$html = str_replace( $attr['sizes'], '(max-width: 767px) 200vw, 100vw', $html );
}
return $html;
}