Archived topic
Problem with pictures in generatepress with shortpixel plugin
3 replies · Started by Yves on January 13, 2022
Hi,
I am using a custom child theme, with the premium version of GP.
1. The first problem I have, without any plugins, is that on the homepage and in categories, it serves the featured image in the original size not in thumbnail size. I checked here in the site library, and it does the same thing.
On my installation I checked with ftp and all the thumbnails are created but not served. They are even in the code if you inspect. Am I missing something here? Because if I use any website speed checker, it shows the full featured image is loaded. Same on my desktop.
2. When I use shortpixel plugin, it does not replace the image with the WebP version. I never had this problem with another theme. I guess I am doing something wrong?
When I use their adaptive plugin, that serves the images automatically from their CDN, it works perfectly fine by the way.
Hi there,
lets get #2 out the way - the Theme has no control over the media library or how shortpixel integrates with that. I can say i have worked on several sites using GP + Shortpixel without any issue - i suggests speaking with shortpixel to see what the problem is.
#1 GP uses the default max-sizes attribute that WP generates - you can see its output in the image HTML - it looks like this:
sizes="(max-width: 1920px) 100vw, 1920px"
Its WP's attempt at a catch-all responsive behaviour but it relies on the image to fill 100% of the viewport width.
So somethings you can do in the theme to improve that. But first you need to enable the Blog Module in Appearance > GeneratePress then you can edit the Featured Image options in Customizer > Layout > Blog:
https://docs.generatepress.com/article/adjusting-the-featured-images/
Select the Posts tab.
1. Select a smaller Media Attachment size
2. Uncheck Display Padding Around Images - this one will make sure the image fills the viewport for true responsiveness.
If need be i can provide a custom function to rewrite the max-sizes.
Hi,
thanks. I found out the problem is my hoster. (Closte.com - Lightspeed Hosting, in case anyone ever has the same problem)
After I installed the website on another hoster it worked fine.
The Main Problem I still have is the Blog and Category pages: Here the full sized picture is served instead of the thumbnail size.
Can you tell me how to fix this?
Have you tried changing the Customizer > Layout > Blog --> Featured Images >>> Attachment size for the Archives ? You cans set it to medium_large which is the 768px image, which is good for most mobiles they are x2/x3 HD screens now.