Smush shows 33 images needs smushing after completing bulk smush

Smush shows 33 images needs smushing after completing bulk smush when we click “Recheck Images”. https://cdn.livechat-static.com/api/file/lc/att/8801096/c20c96f1038d5e62e89cc567ca4a004e/Schermopname%202020-01-22%20om%2008.37.06.mov

  • Adam
    • Support Gorilla

    Hi Dominique

    I hope you’re well today!

    I have checked the site and I can also see the issue happening there.

    Usually such issues are caused by some sort of “persistent” server-side cache, especially an object cache which is a way to speed up getting DB query results (it stores results of most common recent DB queries) and since Smush is keeping information about which images require smushing in the database – that can severely interfere.

    However, I also checked your server via Plesk panel that you provided access to and I didn’t find any references to such caching there. There’s also no related errors in debug.log or PHP logs so I must admit I’m a bit stuck.

    I’ll need a consultation from our developers on this one so I’ve already referred the case to them and am awaiting their response. They’ll examine the case and we’ll update you here as soon as we get to know more so please keep an eye on this ticket for further information.

    Best regards,
    Adam

  • Panos
    • SLS

    Hi Dominique ,

    Apologies for the delay. The admin login info is not working and I’m not sure that the ftp is for the same site as adding some logging didn’t appear. Could you please re-send in admin and ftp credentials? Keep in mind though not to share such info in your replies here, as this is a public forum. Instead you can send that privately through our contact form: https://wpmudev.com/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

    Thanks for sending those in Dominique !

    Seems that the IP block wasn’t yet applied, so I got lucky :slight_smile:

    From what I see there are 258 images that have in their meta, the width and height greater than the biggest of the dimensions chosen to be Smushed. So on each Re-Check Smush sees (falsely) that there are some greater images that are probably not Smushed.

    So there are no UnSmushed images, but due to those old values in the image meta, those keep coming back on each Re-Check. This is probably due to some manipulation on images or some theme change (that uses different image sizes) or migration. Hard to tell why those sizes are not correct without a history.

    So I would suggest to keep a full site backup and try run a Bulk Restore from Smush > Tools > Bulk Restore. Then Bulk Smush again and hopefully the restore would manage to update those meta, so those won’t show up again on Re-Checks. If they still show up though, please let us know so we could try manually changaing those to the highest site dimension. Also do confirm that you have a full backup before we try changing those.

    Kind regards!

  • Panos
    • SLS

    Hi Dominique ,

    In regards to this issue, I have also prepared a custom snippet that might help. That will check those images that keep coming up, resize them to the dimensions set in the Smush Resize option and update the dimensions in meta too. So this way they should stop coming back appearing as they need to be Smushed. It keeps a backup too in case you need the original ones.

    In case you are interested to give it a try, first make sure you have a full site backup. Then you can download the file from here :
    https://gist.github.com/wpmudev-sls/29a8a774be810d5f34ce6dac4842c16b
    unzip it and upload it to your wp-content/mu-plugins folders. If that folder doesn’t exist you can simply create it.

    Once uploaded, you should see a new menu under Smush’s menu in admin. In the page it opens click on the button to start the reset for those images. Once that is done, try clicking on Smush’s Re-Check button. It should should be clear this time.

    It would be much better if you would test this in a staging site first. Let me know if you would like me to run that on your site once you confirm that you have a recent backup.

    Kind regards!

    • Noeste IJver
      • Recruit

      Hi Panos,

      Adding the folder to the folder ‘mu-plugins’ didn’t work for me, I couldn’t see the menu. However, I added the folder to the regular plugins folder and I could see the plugin. After activating it I could see the new menu and run the function.

      I had to re-run the bulk smush process, but now after re-checking nothing new turns up. This seems to solve the problem, then. I’ve tried this on two sites.

      Will this function be integrated in the regular Smush Pro? I will save your repository and the folder, but it would be a great addition if this could be done through the normal plugin.

  • Panos
    • SLS

    Glad to know this worked for you :slight_smile:

    I have brought this to the attention of the devs, but I’m not sure this will be included as it’s about some rare cases, it is still under review and I can’t give an answer to this currently.

    I don’t think you’ll be needing this snippet from now on, from what I see it’s about specific images, either imported by theme/plugin, or after migration. After reset their sizes you can delete that plugin/mu-plugin. Any new image uploaded shouldn’t have this issue, at least under normal circumstances.

    Adding the folder to the folder ‘mu-plugins’ didn’t work for me

    I’m sorry I wasn’t clear here. After extraction you need to upload only the php file instead the containing folder :slight_smile:
    You can read more about mu-plugins here :
    https://wpmudev.com/docs/getting-started/download-wpmu-dev-plugins-themes/#installing-mu-plugins
    We intentionally include plugin headers in custom snippets so it can be installed as a plugin too.

    It gave a ‘bad JSON’ error in the debug console

    Did that site have a big number of images that needed to be re-sized? It is a custom snippet and didn’t emphasize in ui as I should, because it was quite a complex issue to spot and try overcome. So I missed to use some flagging method that would loop through less images on each run making it lighter and less likely to crash. Sorry for that, it was a decision to save some time.

    Kind regards!

    • Noeste IJver
      • Recruit

      Hi Panos,

      I have brought this to the attention of the devs, but I’m not sure this will be included as it’s about some rare cases, it is still under review and I can’t give an answer to this currently.

      I understand, but I’m not sure how ‘rare’ this case really is. I feel like I’ve got several client websites with this problem, but I’m not fully aware of the amount of sites that have the problem as it’s a time consuming task to get such an overview.

      I’m sorry I wasn’t clear here. After extraction you need to upload only the php file instead the containing folder

      Right, I wasn’t aware of this.

      Did that site have a big number of images that needed to be re-sized?

      Not that much more images than the first one I tried, but yeah it had more. And more with the problem we’re talking about currently. But it’s solved by running the function multiple times so for a one time procedure it’s not that much of a problem. No need for apologizing!

  • Panos
    • SLS

    I understand, but I’m not sure how ‘rare’ this case really is

    I’m not saying that the devs won’t check it out, I just can’t confirm anything right now. I would like to repeat here that the images that have the dimensions that site uses have been Smushed, so only Smushed images will be loaded in your front end (when using WP functions).

    In more details, when you upload a new Attachment, WordPress will check if it is an image. If it is an image, it will generate additional images depending on the sizes that the site needs (usually set using the https://developer.wordpress.org/reference/functions/add_image_size/ function in themes and plugins).

    All those additional image sizes are the ones that will be loaded in your front end, and those have been Smushed. You should be able to see the savings on each attachment from the Media page in admin.

    For some reason the original attachments (which are also stored in posts db table) have kept old meta. This is not related to Smush, however it does check those sizes on each Re-check, so that’s why they appear as they need re-smushing although they have been already smushed.

    Hope I didn’t confuse you :slight_smile:

    Kind regards!

      • Panos
        • SLS

        Nah, existing images are not the issue, images that have been imported in ways other than using WP uploader could be though. For instance importing demo content via a theme’s/plugin’s option, or importing via migration. It depends on how that was done that’s why it’s hard to find the source.

        Let us know if still have any similar case so we could check it out :slight_smile: