Smush Lazy Load adds empty space below carousel images

When Smush Lazy Load is active a large empty space shows up right below the carousel images. The carousel navigation arrows are also moved down into that empty space area rather than sticking withing image area.

  • Adam Czajczyk
    • Support Gorilla

    Hi Mark

    I hope you’re fine today!

    I’ve already passed all the information about the issue and my findings to our developers for further investigation and they’ll look into it.

    Please keep an eye on this ticket and we’ll update you here as soon as we get to know more about the problem and possible solutions to it.

    Best regards,

    Adam

  • Adam Czajczyk
    • Support Gorilla

    Hello Mark

    I’m sorry for keeping you waiting. I’m waiting for an update on this form our developers. Please note that they are dealing with a lot of complex stuff on daily basis so their response time might be longer than hours here on support forum but we’ll update you here as soon as we get information from them.

    Kind regards,

    Adam

  • Panos
    • SLS

    Hi Mark !

    This happens because Smush will set the data-srcset and data-src attributes in images, but when those are added the carousel’s script seem to calculate wrong image height for some reason.

    One way for this would be to disable lazyload from pages with carousels. This can be done from the Lazy Load settings of Smush.

    Another way would be to exclude specific images from being lazyloaded using the smush_skip_image_from_lazy_load filter. But here we need to specify the exact image src loaded in page (image size), not the one set in the Carousel. Here’s an example of using that filter:

    add_filter( 'smush_skip_image_from_lazy_load', function( $skip, $src ){

    $skip_images = array(
    'http://wpmudev.test/wp-content/uploads/2019/07/landscapes-and-buildings-1-713x1024.jpg',
    'http://wpmudev.test/wp-content/uploads/2019/07/landscapes-and-buildings-2-1024x576.jpg',
    'http://wpmudev.test/wp-content/uploads/2019/07/landscapes-and-buildings-3-1024x460.png',
    );

    if ( in_array( $src, $skip_images ) ) {
    return true;
    }

    return $skip;
    }, 20, 2 );

    where you need to replace the images urls with the ones in your page.

    If none of the above works for you, I have prepared a custom snippet which will not add the data-scrset attribute in any image in pages that contain a carousel. This snippet can be downloaded from here:

    https://gist.github.com/wpmudev-sls/1fe5212104f97ce7bb33c68826c380af

    Since we don’t have ftp access, if you want to test this out please first do on a staging site. Download the zip, extract and upload file:

    wpmudev_smush_bakery_carousel.php

    to your wp-content/mu-plugins folder (if that folder doesn’t exist you can simply create it).

    Kind regards!

  • Adam Czajczyk
    • Support Gorilla

    Hi Mark

    Are you sure that “wp-migrate-db-pro-compatibility.php” is the right file? I’m not sure but the name of the file doesn’t seem like related to the Smush CDN issue and suggest there’s some different code inside.

    I can see that Panos shared workaround with you in his post above:

    https://premium.wpmudev.org/forums/topic/smush-lazy-load-adds-empty-space-below-carousel-images#post-1418472

    Have you tried to follow it exactly again, just for the shopbio.co.uk site this time?

    Best regards,

    Adam

  • Mark
    • WPMU DEV Initiate

    No that wasn’t the best option as that means we have to update the functino for ever single image that is changed.

    The fix was a PHP file that was added to hte mu-plugins folder, that fixed it. We have it on justbbguns.co.uk and justairguns.co.uk and it worked.

  • Panos
    • SLS

    Hi Mark !

    In my last reply I provided 3 potential solutions which you can try and choose the one that best fits your needs.

    The file I shared to add to the mu-plugins folder is :

    https://gist.github.com/wpmudev-sls/1fe5212104f97ce7bb33c68826c380af

    Not sure what the file you mention wp-migrate-db-pro-compatibility.php is about, but by it’s title it doesn’t have to do with this case. Could you explain what exactly you tried on that site? It would be even better if you would share admin and ftp access to that site so we could have a better look there. You can send that privately through our contact form: https://premium.wpmudev.org/contact/#i-have-a-different-question

    Send in:Subject: “Attn: Panos Lyrakis”

    – Admin login:

    Admin username

    Admin password

    Login url

    – FTP credentials

    host

    username

    password

    (and port if required)

    – link back to this thread for reference

    Kind regards!

  • Panos
    • SLS

    Without ftp (or cpanel or ssh) I can’t check if there are any php errors nor can I add/edit files.

    That file is on the server, but it breaks it

    The file you are talking about is:

    https://gist.github.com/wpmudev-sls/1fe5212104f97ce7bb33c68826c380af

    and by breaking you mean the entire site is down or some styling issues on the carousel page?

    Could you confirm that the following meets what you have:

    1. You have latest version of Smush (currently 3.2.4)

    2. You have download zip from https://gist.github.com/wpmudev-sls/1fe5212104f97ce7bb33c68826c380af.

    3. You extracted the php file from the zip and uploaded it to your wp-content/mu-plugins folder

    Perhaps it’s worth sending in ftp if it stays active for a few hours. I will be around for some hours so you could try send that in now if you like.

    Kind regards!

  • Panos
    • SLS

    Thanks for sending that, however keep in mind that this is a public forum and you should not send sensitive information in your post replies here, but follow instructions mentioned in a previous reply here :

    https://premium.wpmudev.org/forums/topic/smush-lazy-load-adds-empty-space-below-carousel-images#post-1421746

    I did connect to the ftp account, however I have this feeling that this ftp account is not for this site https://www.shopbio.co.uk, as whatever filter/hook (regardless of the issue, general hooks like wp_footer) I try does not seem to have any affect. Also I don’t see the wp-hummingbird folder listed in the plugins folder which means that Hummingbird isn’t installed there.

    Could you confirm and possibly resend new ftp and admin creds? Make sure you use the way mentioned above.

    Thanks!

  • Panos
    • SLS

    Thanks!

    I mentioned about Hummingbird because I thought there was some cache not allowing the changes to appear on site, but the way I mentioned it didn’t really make any sense :slight_smile:

    I have changed the script on your site so it excludes the images of being lazyloaded on the gallery page for now. There should be no gap there anymore. I’m still not sure why the original fix isn’t working on your site. I would like to do other tests however it is a live site so I’d rather not do experiments there and risk breaking the site for a while. That’s why I think this is the best approach on this case :slight_smile:

    Kind regards!

  • Mark
    • WPMU DEV Initiate

    Hi there.

    that fix is fine, but obviously not for when we change images.

    I can ‘pull from live’ the Live content to our staging, and give you access to the staging version to test all you want. It does lock each night, so if you need access, we will have to unlock it.

    When you go into FTP, you go up a level into vhosts then into staging.shopbio.co.uk.

    I’ve done a pull, so you should now see it. The login is the same: https://staging.shopbio.co.uk/wp/wp-login.php.

    FTP is unlocked for today.

  • Panos
    • SLS

    Hey Mark!

    not for when we change images

    You mean when changing the images in the carousel? I didn’t notice anything like that in my site. Staging would be great to check things out! Thanks! However the staging is redirecting to the production site and can’t check. Could you have a look and let me know?

    Thanks!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.