- This topic has 13 replies, 3 voices, and was last updated 3 years, 9 months ago by frankie.
-
AuthorPosts
-
June 13, 2020 at 5:13 am #1326139Michael
Hello all,
In Google Web Dev I’m getting warnings about featured images being the wrong size eg:
https://www.dropbox.com/s/zc5622zkww2qw0i/featured-image-inappropriate-size.jpg?dl=0
I can’t work out where any of these sizes are coming from. I’ve uploaded the featured image as 750 x 422, and in my media settings thumbnails are set as:
https://www.dropbox.com/s/v7qp7fmn7ze65id/media-settings-image-sizes.jpg?dl=0
I thought the idea was that the media library thumbnails were used to serve the images responsively? If I inspect the element I see:
https://www.dropbox.com/s/iul5a1dc1pyyk2c/featured-image-inspect-element.jpg?dl=0
I’m not setting this vw code, so wanted to ask if the theme is doing this? And if so how I can set the images to appease Google and avoid the warning in web dev?
Please can you tell me what I’m missing or point me in the direction of a relevant article that answers the question (I haven’t been able to find any specific to this issue).
Many thanks for your help.
Michael.
June 13, 2020 at 9:14 am #1326518MichaelI asked about this on the wordpress forum also and someone replied with:
Well, no the media library does not manage the responsiveness. The theme does.
However, your image is correct in rendering the 750px :
https://imgur.com/a/v3jiBUBBut the theme is rendering at 750px when in small mode :
https://imgur.com/a/MR8B3q1June 13, 2020 at 9:38 am #1326559TomLead DeveloperLead DeveloperWhile I’m sure a theme could set the sizes, we don’t. We simply use
the_post_thumbnail()
, which is a core WordPress function that outputs the featured image.Are you wanting to adjust the values in
srcset
?If so, this might help: https://wordpress.stackexchange.com/questions/287522/understanding-wordpress-image-sizes-and-responsive-images
June 13, 2020 at 4:14 pm #1326827MichaelHi Tom, I got it to finally work by setting the width and height for featured image in customizer under layout \ blog and then resized my images that didn’t fit this to the correct size and reuploaded. Then when testing in web dev the warnings about size were gone.
June 13, 2020 at 4:24 pm #1326832MichaelScratch that….. Worked fine on desktop, but when checked on mobile just now not as much….
June 14, 2020 at 9:48 am #1327585TomLead DeveloperLead DeveloperAs long as your images are optimized and sized correctly (not too big, not too small), I wouldn’t worry about it that much.
I just tested your site in Insights and Lighthouse and didn’t see the above issue.
June 14, 2020 at 12:11 pm #1327689MichaelThank you Tom 🙂 I removed the featured images from showing up on individual blog posts and that helped. They only show on the blog page itself now
June 14, 2020 at 4:37 pm #1327915TomLead DeveloperLead DeveloperIf you want to re-add them I can take another quick look at the HTML 🙂
June 15, 2020 at 2:36 am #1328198MichaelHi Tom,
Thank you very much 🙂 The issue is still visible on the blog page itself (under Best Practices result here):
June 15, 2020 at 9:56 am #1328902TomLead DeveloperLead DeveloperI’m not really seeing anything wrong with that image.
You could try disabling srcset to see if it’s the cause: https://wordpress.stackexchange.com/a/211985/90661
June 15, 2020 at 1:18 pm #1329104MichaelThanks for checking Tom. I don’t see anything wrong with it either – bloody Google 😉
June 15, 2020 at 2:36 pm #1329168TomLead DeveloperLead DeveloperNo problem. Will keep this topic in mind in case I end up finding a solution 🙂
June 15, 2020 at 2:49 pm #1329173MichaelThanks Tom – I appreciate it!
July 5, 2020 at 4:37 pm #1353168frankietry his in your custom css :
.featured-image img {
object-fit: contain;
}that work for me 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.