[Resolved] Incorrect version of featured image often served

Home Forums Support [Resolved] Incorrect version of featured image often served

Home Forums Support Incorrect version of featured image often served

Viewing 15 posts - 1 through 15 (of 24 total)
  • Author
    Posts
  • #2060969
    Ed

    I have set the Media Attachment Size for my blog’s featured images to Medium. This is defined in the Media Settings to be 500×328. The majority of my images have that resolution. Yet as often as not what I see served to a web page is a higher resolution image which is then scaled down as appropriate. Any clues as to how to resolve this would be greatly appreciated.

    #2061141
    Leo
    Staff
    Customer Support

    Hi there,

    Any chance you can link us to the site in question?

    You can use the private information field:
    https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information

    Let me know ๐Ÿ™‚

    #2061161
    Ed

    The first link below is a post that seems to exhibit this behavior. When I opened it just now and did an inspection, it showed the proper dimensions.
    http://aclayjar.net/2017/08/arminianism-total-depravity/

    But when I looked in my CDN logs I found it sometimes loading the right image and sometimes a larger image. And one client (I think me) that ended up with both, about 5 minutes apart.
    https://aclayjar.b-cdn.net/wp-content/uploads/The-Doctrine-of-Total-Depravity-500×328.jpg.webp
    https://aclayjar.b-cdn.net/wp-content/uploads/The-Doctrine-of-Total-Depravity-768×504.jpg.webp

    No doubt I am not seeing something I should, but I am confused about this.

    #2061170
    Leo
    Staff
    Customer Support

    Have you tried disabling all plugins except GP Premium to test?

    Does this issue occur in a Twenty series WP theme?

    #2061187
    Ed

    The duplicate image with different resolutions was apparently not me. But I did go into troubleshooting mode and used Twenty Twentyone as a theme. All of the images were full-sized. I shifted to GP Child with GP Premium, and my images were all correct. I then reenabled all of my plugins and the only difference was that it was loaded as both an img and picture. Everything today seems OK when I test myself. But I still am consistently getting the image size that fits between Medium and Large.

    Could it be the browsers or devices they are using?

    #2061265
    Elvin
    Staff
    Customer Support

    Hi Ed,

    How this your image displays has to w/ with Perfmatters, the image optimization plugin your site is using.

    It may be best to ask them about how their plugins work /w the images. (how it’s served, how to limit the srcset images to add, etc)

    A wise man once said:
    "Have you cleared your cache?"

    #2061317
    Ed

    I am using Imagify to compress my images. Permatters just gets involved with the Lazyload and adds missing dimensions to the image. I thought that my theme, GeneratePress, was responsible for image selection.

    #2061332
    Elvin
    Staff
    Customer Support

    I am using Imagify to compress my images. Permatters just gets involved with the Lazyload and adds missing dimensions to the image. I thought that my theme, GeneratePress, was responsible for image selection.

    Ah yes, or Imagify (for compression and/or CDN specifically for image).

    WordPress core function actually picks what image to assign as the featured image along with its srcset and the default is usually just plain <img> tag + srcset. Imagify adds extra wrappers and change the src/srcset to serve it from CDN.

    But yes I get your point. It’s an issue w/ the srcset and the device’s browser as it’s up to the browser to decide what it will take from the srcset.

    We can try “guiding” the image to be used by adding more image sizes but this may eat too much space because of the image generated. We can also try removing the 768ร—504 image size but this will mean you can’t use that image size for other things anymore.

    More about this here – https://generatepress.com/forums/topic/implement-new-srcset-for-feature-images/

    A wise man once said:
    "Have you cleared your cache?"

    #2061946
    Ed

    Thanks. I will get back to this this evening. I am really only using the medium-sized images, so removing the 768×504 would not hurt me at all.

    #2062266
    Elvin
    Staff
    Customer Support

    No problem. Let us know how it goes. ๐Ÿ˜€

    A wise man once said:
    "Have you cleared your cache?"

    #2062274
    Ed

    I have since all this started. I have installed the Regenerate Thumbnails plugin and found that there are many image sizes that I am not interested in. Is there an easy way to unregister the sizes and remove the images of that size?

    #2062277
    Elvin
    Staff
    Customer Support

    You can refer to WordPress’ documentation here – https://developer.wordpress.org/reference/functions/remove_image_size/ – for the function used to remove image sizes.

    On the page I’ve shared, you’ll see examples of how it’s used.

    Here’s how to add PHP code snippets to your site – https://docs.generatepress.com/article/adding-php/

    A wise man once said:
    "Have you cleared your cache?"

    #2062316
    Ed

    Thanks. That has eliminated many of them. But the medium-large image size is still hanging around, the one that is 768×512.

    #2062321
    Elvin
    Staff
    Customer Support

    You can remove it with a filter:

    Here’s an example:

    add_filter( 'intermediate_image_sizes_advanced', 'remove_default_medium_large_image' );
    
    function remove_default_medium_large_image( $sizes ) {
     unset( $sizes['medium_large']); // 768x512
     return $sizes;
    }

    You then clean your media for images generated previously w/ this registered image size and then regenerate thumbnails for the image sizes left.:D

    A wise man once said:
    "Have you cleared your cache?"

    #2062399
    Ed

    I added that code to the bottom of the functions.php file in my child theme, but it did not remove it from the list on the Regenerate Thumbnails plugin. I also checked “Delete thumbnail files for old unregistered sizes in order to free up server space” on Regenerate Thumbnails, and it seemed to do nothing. There is a mix of odd sizes left behind. Tried it twice at an hour and a half each time. I realize that is not your plugin, but if you have any hints it would be most appreciated.

Viewing 15 posts - 1 through 15 (of 24 total)
  • You must be logged in to reply to this topic.