Archived topic
Featured Images
10 replies · Started by Janine on April 20, 2018
Hi.
When I analyze my homepage, for example, at Google PageSpeed Insights and GTmetrix, my images seem to slowing down my site.
And I think it is mainly because of how the theme is handling feature images.
When I download the optimized images, the dimensions are these images are 365x243. And it seems like if I upload them to my server, it will overwrite the 900x600 original images.
I've read this: https://docs.generatepress.com/article/adjusting-the-featured-images/.
But when I changed the dimensions for the featured image on the archive page at Layout > Blog, it made the image super tiny, which is not the look I"m going for.
How do I make Google and GTmetrix happy? And maintain the design I want?
Cheers!
Hi there,
The theme is using the standard WP way to show featured images, which actually uses srcset to show images closest to the size of the content area.
Perhaps you just need to optimize your images before you upload them? There's lots of plugins to do this, but I usually just use a tool like http://optimizilla.com/.
Let me know :)
Hi, Tom.
Thanks!
I do optimize my images before I upload.
FIRST, I resize them to 900x600 in Canva.
SECOND, I optimize them at optimizilla.com.
And still GTmetrix and PageSpeed want to optimize the featured images further to 365x243.
Thank you!
Ah, it doesn't like that you have large images (900px wide) inside the columns.
Perhaps try a function like this:
add_filter( 'generate_page_header_default_size', 'tu_smaller_column_images' );
function tu_smaller_column_images( $size ) {
// Set up our conditional
if ( ! is_singular() && ! in_array( 'featured-column', get_post_class() ) ) {
return 'medium';
}
return $size;
}
Adding PHP: https://docs.generatepress.com/article/adding-php/
Let me know :)
Thanks, Tom.
I will try the function.
I determined that my feature image width was 750 for posts and 800 for pages. And content is 670 for posts and 720 for pages.
So I decided to make all images 900px wide.
BUT going forward should I reduce the width of my images?
Thank you!
Tom,
I tried your function and it seems to have worked! Thank you so much! 😁
You're very welcome! :)
Hi, Tom.
Going forward should I reduce the width of my images? Thank you!
Your images should be big enough for your featured post at the top.
From now on, the posts within the columns will use the "medium" image size, which you can see configured in "Settings > Media".
Thanks, Tom. Got it!
Awesome, glad i could help :)