- This topic has 7 replies, 3 voices, and was last updated 4 years, 11 months ago by
David.
-
AuthorPosts
-
May 4, 2021 at 11:35 pm #1764911
litesprint
Hi,
I’ve set the size of featured image in archive view as ‘medium’, yet full-sized images are being displayed instead of the medium-sized thumbnail.
This is happening across all my sites.
May 5, 2021 at 12:07 am #1764961Elvin
StaffCustomer SupportHi there,
The post list on the site you’ve linked seems to be created within thrive editor (TAR/Thrive Architect).
The theme doesn’t control how the plugin presents the images.
And since Thrive Architect is a third-party plugin outside of our scope of support, I recommend asking them the best practice on how to deal with this. 🙂
May 5, 2021 at 11:00 pm #1766721litesprint
No, I didn’t refer to those pages using TAr. Check archive pages (such as categories) which are populated by GP. Check the source code to be sure.
May 5, 2021 at 11:33 pm #1766771Elvin
StaffCustomer SupportAh I see.
By default, GeneratePress let’s WordPress Core functions handle the serving of the images.
Tom added a filter that may help though, please see this
https://github.com/tomusborne/generatepress/blob/b60b853630da6d9015722da903e53c8064148b0a/inc/structure/featured-images.php#L35You can modify the parameters of
get_the_post_thumbnail()through thegenerate_featured_image_outputfilter.You can then optimize how WP serves its srcset – example – https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/#comment-2813
Note: Your srcset only has 2 images as opposed to WordPress default (thumbnail, medium, large, full). I’m not sure if this was intended but consider adding more image sizes incase needed.
May 6, 2021 at 5:11 am #1767169litesprint
Why should I spend my time on these things when there’s a clear option within Customizer to specify the size of the thumbnails:
https://i.gyazo.com/51e0e27f70eddb9e57b0147283c5d57e.png
It’s not working as intended, so either I’m doing something wrong or this functionality is buggy.
I knowingly disabled image sizes other than full and medium as I don’t need the others. But why would it not work with medium sized images when those are indeed present?
May 6, 2021 at 7:33 am #1767623David
StaffCustomer SupportHi there,
that is the default behaviour of WordPress – its so as the Browser can select the most appropriate sized image – which when considering Retina / HD devices that image may need to be larger then the one specified.
If you want – you can try using adding this PHP Snippet to stop that from occurring:
function set_max_srcset_width( $max_width ) { $max_width = 300; return $max_width; } add_filter( 'max_srcset_image_width', 'set_max_srcset_width' );I set the
$max_width = 300;which is the default size of the Medium image. If that has been changed in Settings > Media then you should change the above value to match.May 6, 2021 at 10:57 am #1767883litesprint
Oh, I see, it’s happening because of srcset! Perhaps me using a high-res display is causing the browser to fetch the higher resolution photo.
May 7, 2021 at 1:54 am #1768556David
StaffCustomer SupportThat could be the very reason 🙂
Glad we could be of help. -
AuthorPosts
- You must be logged in to reply to this topic.