[Resolved] Wrong sized image file used on mobile

Home Forums Support [Resolved] Wrong sized image file used on mobile

Home Forums Support Wrong sized image file used on mobile

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1064286
    Rauno

    Hi! A GP Pro member here with a bug report for WP Show Posts. I hope it’s ok.

    I was over the moon a month ago when I finally figured out how to use smaller image files with WP Show Posts. I used the following solution provided by Tom: https://generatepress.com/forums/topic/image-sizing-not-working-with-amazon-web-services-and-wp-offload-media/.

    The code I use is:

    add_filter( 'wpsp_default_image_size', function() {
        return 'medium';
    } );

    Now I noticed that the filter works only for desktop. When the page is loaded on mobile or tablet, full sized images are loaded.

    I noticed this first in Firefox Inspector and can see the same if I run webpagetest.org with both desktop and mobile emulation.

    Thanks,
    -Rauno.

    #1064528
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Is there a WPSP list on the page you linked us to? I’m not seeing it.

    Let me know πŸ™‚

    #1066782
    Rauno

    Hi Tom,
    There are two WPSP lists on the page: One between tutorial steps 4 and 5. And another one between steps 8 and 9.
    Thanks!

    #1066929
    Tom
    Lead Developer
    Lead Developer

    Ah, well the code is working, but srcset is in use, which provides different image sizes for different screen sizes. It’s possible to remove it if you’d like?

    #1067752
    Rauno

    Thanks Tom. I had to spend a couple of hours reading about srcset and sizes attributes and related WordPress functionality.

    I ended up disabling the WordPress default srcset attributes. I used these snippets: https://perishablepress.com/disable-wordpress-responsive-images/. Everything seems to be working fine and loaded images have much smaller file size now.

    In the long run, though, I would be more comfortable if WP Show Posts would specify “optimal” sizes attribute. Do you think that would be possible?

    Thanks!
    -Rauno.

    #1067896
    Tom
    Lead Developer
    Lead Developer

    The entire image resizing option in WPSP (and GP) needs to be re-done. It’s high on my priorities πŸ™‚

    #1069023
    Rauno

    πŸ‘ Thanks!

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