Jetpack photon srcset for custom thumbnail
-
I am using Jetpack with Photon on.
I am using hard-crop on featured images like this :`add_theme_support( ‘post-thumbnails’ );
set_post_thumbnail_size ( 635, 200, true );`I have no other settings for wordpress srcset or sizes in my functions.php.
So wordpress generates the srcsets for a featured image uploaded with resolution 1500×1048 as follows:srcset="link-to-image?zoom=2&resize=635%2C200 1207w, link-to-image?zoom=3&resize=635%2C200 1905w" sizes="(max-width: 635px) 100vw, 635px
So it basically crops the image to 635 and then generates 2 versions of it, zoomed from 635 to 1207 and 1905. And needless to say that it loads the 1207 version for sizes smaller than 1905… even on 100×100 device screen it still loads 1207 width image.
Can you please advice on how to set srcset and sizes in functions.php (only for featured imgs) for a site with featured images maximum 635px on any device? But I would still want some srcset for retina if possible.
- The topic ‘Jetpack photon srcset for custom thumbnail’ is closed to new replies.