[Smush Pro] Large (7MB) images are no longer compressing on or after upload

Hi there,

I have been using WP Smush on this site for a number of years – the site is a webcomic and the owner of the comic uploads their strips each week.

The strips are quite large files – between 6-7MB each – and I use Smush Pro to compress these on upload down to around 2MB each.

Recently Smush Pro has stopped working properly on this website. Below is a breakdown of what is happening / what I have tried.

Firstly, uploading a new 6MB image was timing out with a HTTP Error. I fixed this by changing things like the max_execution_time, max_input_vars etc, and by turning off automatic smush on upload.

This allowed us to upload images but when we tried to compress them we were still getting the same error message.

Since then I have optimised the website database, deleted post revisions/trash posts, removed some tables leftover from old plugins, etc.

I have also installed the 'Stop Generating Image Sizes' plugin which prevents the website from generating thumbnails which are not in use, and set it up so that the only thumbnails being generated are the WordPress thumbnail, medium, and large sizes as well as a custom size I have added through functions.php (300px square, hard crop).

I then force regenerated all thumbnails on the website.

Now, when I upload a large image it uploads correctly but it only appears to Smush the generated sizes and not the original full-size image, despite me having that option selected in the Settings.

In the media library, it gives me the option to 'resmush' the image, including the original file, but when I click that button (or try to bulk smush from the plugin page) I get this error message: Error posting to API: 404 Not Found .

This issue first appeared a couple of weeks ago – everything was working fine before that point. All themes, plugins and WordPress core are up-to-date on the website.

If there is any way you can look into this issue I would be very grateful – I am happy to grant you access to the website if that would help troubleshoot.

Thanks

Hannah

  • Adam
    • Support Gorilla

    Hello Hannah

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

    I’ve just tested Smush on an image of over 13M on one of my test sites (hosted on a cheap shared-hosting) and the full-size image was nicely smushed, saving over 5M with no “super-smushing” option enabled.

    It seems therefore that this is something specific to either the site itself or to the hosting so do you recall any changes recently made to any of those? Maybe some new plugins/some custom code added or some additional changes in server config?

    Let me know please and it would also be great if you could enable support access to the site so I could check it. To do that, please go to the “WPMU DEV -> Support -> Support Access” page in the site’s back-end and click on “Grant support access” button there, then notify me here (as I won’t get any automated notification).

    However, before you do this, please check one more thing: clear all possible caches on site and server (if there are any), go to the “Smush Pro -> Settings” page and use the “Update API Status” button at the bottom of the page – see if that changes anything and/or if there are any error messages then.

    Looking forward to hear from you,

    Adam

  • Hannah
    • WPMU DEV Initiate

    Hi Adam,

    Thanks for your response. I’m trying to think back as to the order in which things were done – I’m pretty sure I didn’t make any changes to the server config until after this issue had arisen. I did add some code to functions.php to try and increase the quality of the thumbnails WordPress generates;

    add_filter('jpeg_quality', function($arg){return 100;});
    add_filter( 'wp_editor_set_quality', function($arg){return 100;} );

    function wpb_image_editor_default_to_gd( $editors ) {
    $gd_editor = 'WP_Image_Editor_GD';
    $editors = array_diff( $editors, array( $gd_editor ) );
    array_unshift( $editors, $gd_editor );
    return $editors;
    }
    add_filter( 'wp_image_editors', 'wpb_image_editor_default_to_gd' );

    I just removed this code but it doesn’t appear to have solved the issue.

    I’ve granted support access to the site, so if you are able to take a look I’d appreciate it. There are a number of plugins installed providing various functionality – I’m not aware of any known conflicts between any of them and WP Smush, but if you spot any which you know to be a problem please let me know. Image compression is one of the most important things on the site so I’m happy to look for alternatives to anything which might be causing a conflict.

    Please note that this is a live site, not a staging version, but I have taken a full backup.

    Many thanks

    Hannah

  • Adam
    • Support Gorilla

    Hi Hannah

    Thank you for additional information and for enabling support access.

    The code that you added to (and removed from for testing) the site is fine and it shouldn’t affect Smush in any way, especially limiting it’s compression abilities based on filesize. I have also checked installed plugins and I don’t see any plugins there that are known to cause conflicts.

    However, I have also tested uploading images. I have uploaded three images to your site directly to the Media Library via “Media -> Add new”.

    The images were accordingly: 7.01MB in filesize, 13.9MB and 14.9MB. In all cases they were all smushed – all of their sizes (original and automatically created smaller ones). I left the biggest one in Media Library for you to check, take a look at “Stats” in Smush column for the “11-axl-by…” image there.

    Having said that, I’m not sure if I’m missing something here or we’re not quite on the same side. Should I try to upload this images in a different (specific) way then or should I check something else apart from Smush stats? Please note: I did not bulk-smush them and I did not use “re-smush” button, I merely uploaded them using standard Media Library uploader.

    Let me know please and I’ll further investigate it.

    Best regards,

    Adam

    PS. Please note: I left the image on site for you to check but you might want to remove it as I”m honestly not sure about this image licence so it’s safer to not keep it there.

    Best regards,

    Adam

  • Hannah
    • WPMU DEV Initiate

    Hi Adam,

    Thanks so much for doing some detailed testing, this is a huge help.

    You’re not missing anything or misunderstanding what I’m saying – that’s exactly how I was previously uploading images to the site, and where I was experiencing the problem.

    Thanks for confirming it’s not an issue when you upload images yourself. That’s very strange, but obviously not an issue with either the plugin or the specific configuration on this website. I shall continue to investigate!

    Thanks again

    Hannah

  • Hannah
    • WPMU DEV Initiate

    Hi Adam,

    I have been doing some more investigating, and I have found that while WP Smush is fine compressing jpeg images on this site, it doesn’t seem to work with PNG images. I have tried uploading large jpeg files here to corroborate what you said about it working fine, and they were correctly compressed. However, if I try to upload the PNG image which was not previously compressing, or another PNG image of a slightly smaller size (4.9MB), the image sizes generated by WordPress are compressed whereas the full size image is not.

    If I then try and use the ‘resmush’ button or ‘bulk smush’ option I get the same error message about not being able to reach the API.

    I have attached two files here – these are the same comic strip, one as a jpeg and one as a png. If I upload them to the site the jpeg compresses but the PNG does not.

    Is there any reason why WP Smush would be having trouble with PNG files but not jpegs?

    Thanks

    Hannah

  • Adam
    • Support Gorilla

    Hello Hannah

    Thank you for your response and additional information!

    I did test only jpeg images, indeed, as I didn’t have such a huge PNGs at hand and I honestly didn’t think that this might make a difference here. I’m not aware of any limitations so I’d need to test it more.

    Unfortunately, the images that you said you attached didn’t came through (you cannot attach such big files to posts here) and the support access to the site is no longer active as well (it’s time valid so it can expire “on its own).

    In this case, would you mind uploading these example images to some file storage of yours (e.g. your Dropbox or Google Drive account) and sharing a direct download link with me here? Please zip these images first so we’d be sure that Dropbox/GDrive didn’t do any optimization on them on its own.

    I’ll then download them and do some tests on my site with them and compare that with other images too to check if it’s something specific or there’s some issue with either the plugin or the optimization app on our cloud.

    Best regards,

    Adam