• Sample Page

    The top image of the castle on this page is being served a 720 wide image, which is then re-sized to 660 wide even though there is a 660 wide image available.

    <img class="size-extra-large-width wp-image-4966" src="https://www.gojapango.com/dev/wordpress/wp-content/uploads/picture/nagoya/nagoya_castle/IMG_0811-720x1080.jpg" alt="Main Donjon (tower) of Nagoya Castle." width="660" height="990">

    Clearly this will use more bandwidth than is required, even though it looks ok on the page.

    Is there a problem with the plugin or am I misunderstanding something?

    https://www.ads-software.com/plugins/ricg-responsive-images/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Tim

    (@tkaufmann)

    Same here, 820px is being loaded on 320×480 even though there is a copy that is 320 px wide.

    Thread Starter whatsupskip

    (@whatsupskip)

    Glad to hear it isn’t just my bad code or misunderstanding.

    I wonder if it is looking for an image that is greater than required size (say 320), rather than equal to or greater than (looking for 321 or larger).

    Plugin Author tevko

    (@tevko)

    Would you mind pasting some sample code?

    Thread Starter whatsupskip

    (@whatsupskip)

    Thanks for looking into this.

    Sample page

    <img class=”size-extra-large-width wp-image-4966″ src=”https://www.gojapango.com/dev/wordpress/wp-content/uploads/picture/nagoya/nagoya_castle/IMG_0811-720×1080.jpg&#8221; alt=”Main Donjon (tower) of Nagoya Castle.” width=”660″ height=”990″>

    The 660 wide file is available on the site. https://www.gojapango.com/dev/wordpress/wp-content/uploads/picture/nagoya/nagoya_castle/IMG_0811-660×990.jpg

    This is why I suspect it jumping to the next size when the matching image size is available.

    Plugin Author tevko

    (@tevko)

    I took a look at the link you posted, and of the images that do have a srcset attribute on them, there are no issues. The code you pasted doesn’t have a srcset attribute present, which means it is not a responsive image.

    If the wrong with is being loaded, then you’ll need to adjust the sizes attribute of the image with a filter. More on that here: https://github.com/ResponsiveImagesCG/wp-tevko-responsive-images#tevkori_get_sizes_string-id-size-args

    Thread Starter whatsupskip

    (@whatsupskip)

    Thank you for looking at this issue tevko.

    This means that your plugin is not the problem and it is currently working correctly on the same page for the Featured Image.

    The problem is with images that are placed into a page/post/category via the Add Media button.

    Does using the “Add Media” button normally produce the correct code with the srcset attribute present?

    If so, where is likely to be the problem with the site I provided the link to? In the Theme used, which is based off the TwentyFifteen theme?

    Plugin Author tevko

    (@tevko)

    Yes, the add media button, in the post editor, should produce a srcset attribute. Are you using the latest version of the plugin?

    Thread Starter whatsupskip

    (@whatsupskip)

    I was using the latest version of the plugin, but to double check I disabled it, then uninstalled and reinstalled.

    No change.

    This is why I tend to think it is something to do with the Theme, but I just don’t know where to even look.

    Plugin Author tevko

    (@tevko)

    Sorry this has been such a hassle! My guess is that it’s theme related. I would check the functions.php file in your theme folder. Make sure that image thumbnail support is on, and also make sure that there aren’t any filters stripping html out of the image tag

    Plugin Contributor Jasper de Groot

    (@jaspermdegroot)

    The images on the provided sample page are inserted at full size. See the width attribute and the class names of the image elements. The sizes attribute is based on this.
    For images that you insert in the post with the editor, use image size large instead. This will be constrained to the content width ($content_width) that should be defined by the theme. For featured images that are included by theme it depends on what code is used to insert the image. If the_post_thumbnail() is used you can use the post_thumbnail_html filter to adjust the attributes.

    Also note that when you test on a HD/Retina device a larger (2x) image will be loaded if available. And some browsers won’t load the applicable smaller image if it already has a larger version in its cache. So make sure you test with an empty cache / cache disabled.

    Plugin Contributor Jasper de Groot

    (@jaspermdegroot)

    Update: I said the post_thumbnail_html filter but it’s easier to use the wp_get_attachment_image_attributes filter.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Larger image being served than should be’ is closed to new replies.