Images are disappearing

After a bulk smush, my images disappeared , please check:

http://www.alastairhu******.com/adventures/

And the slider on the home:

http://www.alastairhu******.com/

  • Adam Czajczyk

    Hello Alastair,

    I hope you're well today and thank you for your question!

    I have checked your site and the missing images are being added via custom fields. They are then displayed using a code in your custom theme that reads values of those fields in a loop and tries to fetch images of certain sizes.

    However, it looks like the sizes used (gallery-large", "gallery-small", "gallery-medium", "gallery-medium", "gallery-small", "gallery-large", "gallery-medium", "gallery-small", "gallery-small", "gallery-medium") are not even defined currently in your setup. If the code tries to fetch non-existing image size, an image URL wouldn't be returned (resulting in an empty "src" attribute of "img" tag) and an error in debug.log. That would actually also explain the "PHP Notice: Undefined index: gallery-large ..." notice there.

    That being said, WP Smush doesn't change/affect what image sizes where registered on site. What I mean is that it doesn't de-register any already registered images sizes and doesn't register new ones. It does process images but that only happens on file level.

    So, if for example this image http://www.....xxxxxxx........com/wp-content/uploads/2008/10/3015371536_137d52c1d8_o-1.jpg exists there can even exist image in a size of "gallery-large" which was defined on site, but if that size is no longer registered it simply won't be fetched.

    Was there anything else changed on site? I realize that the issue "showed up" after bulk-smushing but were there any changes whatsoever made to the site around that time as well? By that I mean anything like e.g. any - even the smallest one - change in theme code, any plugin updates, any plugins disabled?

    Also, I know that conflict test had been run but do I get permission to do some more testing like enabling some disabled plugins and adding "missing" image sizes to the site "manually" - including, if necessary, making small changes in theme code (if so, I'll make sure that I'll keep backup of the theme as it currently is so it could be easily restored if anything goes wrong)?

    Best regards,
    Adam

  • Adam Czajczyk

    Hello @alastairhumphreys!

    First of all, I'm sorry for the delay with my reply. I've been working on this before weekend but didn't manage to solve it yet.

    I was able to fully replicate the issue on my own setup using nothing else but your theme and ACF plugin. The same issue occurs there. I was also able to confirm what I initially found out about those missing image sizes on my own setup.

    That turned out to be small "logic error" in theme's functions.php file, which I was able to fix and the "missing sizes" are no longer missing. However, a bit surprisingly, that still didn't actually solve the main problem so that means that I must be still missing some aspect that I wasn't able to track down yet.

    I'm still looking into it so I'd appreciate slightly more patience. Please keep an eye on this ticket and I update soon with further information.

    Kind regards,
    Adam

  • Adam Czajczyk

    Hello @alastairhumphreys!

    I'm sorry for keeping you waiting, the issue turned out to be a bit more complex to investigate.

    In my previous post I wrote that I managed to fix a small "glitch" in functions.php logic where additional image sizes where not registered and while that did make them register, it still didn't solve the issue. Upon further investigation I found that there where still some image sizes missing.

    It seems that in some parts of your theme you're referring to image sizes that seem to be the same in a different ways, for example: "Feature Wide" and "feature-wide". That's not the same actually.

    I must honestly admit that I'm not sure why this entire issue occurred in a first place. It looks like either theme was edited/updated somehow or it's related to WP core updates. I'm pretty sure though that it's not related to WP Smush even if it's been noticed after smushing images. I believe it's a coincidence as WP Smush doesn't de-register/register any image sizes and it also doesn't/cannot change theme files - I was also able to replicate the problem with WP Smush disabled entirely and only your theme and (required) ACF plugin enabled.

    Anyway, I managed to make some additional changes and that seems to be working, at least as far as I can see it on my own setup (which is not exactly the same as yours). I would like you to test it then on your site. Please follow these steps:

    1. I have attached a zip file to this post so download it and extract (unzip) to your local drive
    2. Access your server via FTP and go to "/wp-content/themes/alastairhumphreys" folder (your theme's folder)
    3. Inside that folder you'll fine a file named "functions.php" so rename it to e.g. "functions.phpORG"
    4. Upload "functions.php" file from inside downloaded .zip file to that folder

    After that, clean all the caches on site and in browser and re-generate your thumbnails and check the site.

    I think that should work. After that you might want to test smushing again but it shouldn't break anything (it didn't on my test site).

    As for the changes that I made in functions.php file, if you compare your current one with the one that attached to this post, please look at lines 95-125 (inside "alastairhumphreys_setup()" function) and you'll be able to see the difference.

    Let me know if that worked for you, please.

    Best regards,
    Adam

  • Adam Czajczyk

    Hello @alastairhumphreys!

    Yes, it seems there was yet another image size that wasn't properly registered that I missed. I'm sorry but the theme is complex and while this is a sort of "reverse engineering" it's not easy to "catch up" everything "in one go" :slight_smile:

    I've attached new version of "functions.php" file for your theme (in an attached .zip file) so please download it and apply the same way as you did previously. Just make sure that after uploading it to the site, you have also again regenerated thumbnails and cleared cache (after regenerating thumbnails) by going to "WPFC -> Delete Cache" in admin toolbar in site's back-end.

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.