- This topic has 6 replies, 2 voices, and was last updated 5 years, 1 month ago by
David.
-
AuthorPosts
-
February 9, 2021 at 10:09 am #1652077
Gulshan
Hello!
How to load responsive featured image?
Right now, it load full size img that’s causing high LCP.Thanks & Regards,
GulshanFebruary 11, 2021 at 10:40 pm #1655301Gulshan
Is there something unclear?
February 13, 2021 at 3:12 am #1656695David
StaffCustomer SupportHi there,
apologies that your original topic was not responded to.
For that layout your archive only needs a maximum 300px wide image, so instead of defining the Width in these settings:https://docs.generatepress.com/article/adjusting-the-featured-images/
Simply select the Medium Attachment size.
February 17, 2021 at 1:43 am #1661381Gulshan
Hello David,
Thanks for your response.Setting Medium doesn’t help. As I have different layout based on screen resolutions.
Current Settings

My requirement is
- Mobile & Tablet: Serve Thumbnail size for screen resolution under 1024px.
- Anything else: Serve Medium size for anything above 1024px.
In other words –
function Media_Attachment_Size( $max_width ) { if ( $max_width <= 1024 ) { // return 'Thumbnail' (Smallest one as per my settings ) } // return 'Medium' }What I tried?

Using switcher doesn’t let me set conditional Media Attachment SizeRef: Video
Thanks
February 17, 2021 at 5:47 am #1661600David
StaffCustomer SupportUnfortunately it does not work like that.
If you select just the Medium attachment WP will output the img src-set with the medium size and any smaller size ( ie. thumbnail ). The browser will then select the best image src for the display.February 17, 2021 at 6:31 am #1661649Gulshan
In the mobile screen,
I selected Thumbnail and tested in mobile, it looks good, I want that. On desktop, it looks too small that is something I don’t like and a reason why I need to serve conditional featured image size.
Choosing “medium” works good at both but in mobile knowingly there is file size is bigger.
Thus, it cause issue in PageSpeed insight with message ‘Properly size images’.February 18, 2021 at 4:28 am #1662999David
StaffCustomer SupportGP uses the WP core function for outputting src-set images. Unfortunately that function makes assumes the the image will fill the full width of the viewport. Without custom development to replace that core function there isn’t much we can do about that.
-
AuthorPosts
- You must be logged in to reply to this topic.