- This topic has 21 replies, 1 voice, and was last updated 12 months ago by K.
July 4, 2019 at 12:42 pm #949230K
I noticed that Generatepress is no longer respecting the Featured Image Size I set in Blog->Featured Images. Instead, it seems to be accurately detecting the available size and inserting the exact desired width/height. While I love this, I need to know what width/height it’s detecting, so I can also set some other code I’m using to render the page. Is there a hook for that?
Thanks.July 4, 2019 at 3:25 pm #949324LeoStaffCustomer SupportJuly 6, 2019 at 10:29 am #950653K
I’ve setup my staging site (same site address but with staging. subdomain) with the Blog Featured Image set to 340×170. If you visit the site, you’ll see that it is using different width/height dimensions in the img tag.
Thanks.July 6, 2019 at 10:41 am #950658LeoStaffCustomer SupportJuly 6, 2019 at 10:49 am #950664K
Yes, sorry!July 6, 2019 at 10:54 am #950666K
I’ve been trying to figure this out myself, and it may not be generatepress after all. It seems the behavior changes when I turn Jetpack on/off.
Thanks!July 6, 2019 at 12:20 pm #950727K
Sorry for the back and forth, but it may be an issue with Generatepress after all.
I turned Jetpack off, then in generatepress layout I set the width to 340, height to 170 for the blog post featured images, but it is not using these values and using the original image values instead.
Thanks.July 6, 2019 at 2:49 pm #950775LeoStaffCustomer SupportJuly 7, 2019 at 9:46 am #951328K
I’ve turned off all plugins except GP Premium, and my custom CSS plugin on my staging site. I’ve also set the blog featured images to 340w x 170h in the customizer layout->blog.
Thanks.July 7, 2019 at 10:50 am #951362LeoStaffCustomer SupportJuly 7, 2019 at 11:07 am #951382K
Unfortunately, I can’t change the container width. It’s a very active live site that went through an approval process.
Also, I’m not trying to actually size them to 340w. In a sense, I’m using the values as max-width/max-height because Jetpack uses the image width/height settings to automatically resize images before it serves them from their CDN. 340w is the largest size that image ever needs to be served (on all screen sizes) for that page.
But more importantly, this was working with this same configuration just a couple of weeks ago. Not sure which of the recent updates changed the behavior, but it should still be inserting the values, even if they are larger than the container width.
If there’s another way, possibly a hook, to set width/height values for the featured images, I’d be happy to switch to using that instead.
P.S. I decided to change the container size to 1600 on the staging site just to test if it would make a difference – it did not. Still not using the values set in the Customizer.July 7, 2019 at 11:42 am #951416K
After looking at the code a little and further testing, I figured out the issue. I had added this to my wp-config.php file since my wp-options table was getting filled every day with tons of entries and significantly affecting my TTFB:
define( ‘GP_IMAGE_RESIZER’, false );
I read on the forums that this would stop the db issue, and this seems to be another side effect.
I’m going to try this filter to see if it can workaround it: generate_blog_image_attributes.July 7, 2019 at 12:17 pm #951445K
Unfortunately the workaround didn’t help. As long as GP_IMAGE_RESIZER is defined, it won’t set width/height values for the featured images.
Do you have any other ideas as to how I can have these values set with GP_IMAGE_RESIZER defined? I don’t mind it running if it wasn’t giving issues, but my wp-options table goes from about 500 records to tens of thousands of records daily until I clean it out again, thus increasing my TTFB from under 1s to 3s or longer.
Thanks.July 7, 2019 at 4:26 pm #951539TomLead DeveloperLead Developer
If the standard resizer isn’t working, you can try this: https://generatepress.com/forums/topic/blog-archives-image-scaling-thumbnail-problem/#post-780773
Let me know 🙂July 7, 2019 at 8:19 pm #951600K
I don’t need a resizer at all, since the jackpack CDN automatically re-sizes the images based on the width and height setting of the image before it serves them.
However as soon as I set the GP_IMAGE_RESIZER to stop resizing, the customizer->layout->blog featured image sizes are ignored by GeneratePress and no longer added to the img tag width/height output. I need GP to respect and insert the featured image width/height I’ve set, regardless of the GP_IMAGE_RESIZER setting.
Without a width/height setting in the image tag, Jetpack cannot resize the images.
But leaving on GP_IMAGE_RESIZER causes my dB to overload with image processing entries, significantly slowing down my site. So I’m stuck leaving it on and cleaning my dB of the entries daily.
Hope that made sense…
- You must be logged in to reply to this topic.