3

WordPress is amazing and I am a very big fan of it.

But the version 5.3 brought me (an many others, 1, 2, 3, 4...) a big problem with its new forced feature for auto-scaling down big images.

I am trying to disable it (because I do not need/want it and because it is not working) with the following filter:

add_filter( 'big_image_size_threshold', '__return_false' ); 

Where the callback function __return_false() is just a WordPress wrapper function to return false.

But it is not working, I still get an error, which means the feature is not disabled.

Same happens with the recommended plugin. It's not fixing the error.

What error?: Postprocessing failed, please scale your image under 2500px.

I did clean the browser cache, set PHP version to 7.2 and activated mbstring (as suggested by others regarding the same problem).

The error happens for some uploads, not for all of them:

And it has nothing to do with uploading big images.

Here are a few facts describing the issue:

  • I am doing random screenshots of random areas (means random sizes).
  • I am always doing small rectangles (max 800px x 400px)
  • Some images will upload fine.
  • Other images will not.
  • But the specific images that work always work if I retry uploading several times.
  • And the specific images that don't always don't if I retry uploading several times (even when renamig the file).
3
  • can you share one or two of the images that worked, and one or two of the images that did not?
    – Caleb
    Apr 26 '20 at 20:18
  • note: took a look at the code in WP core, and did notice that PNGs are excluded from the threshold.
    – Caleb
    Apr 26 '20 at 20:21
  • Dear @Caleb, the images I used for testing where random screenshots with the Windows X native screenshots tool. I deleted those images after doing the tests. But anyway, now everything works fine again with the latest WP version. Apr 27 '20 at 10:38
1

I have the same issue with not being able to turn off big_image_size_threshold (one of the worst new features WordPress has ever put out) for kicks I tried removing the quotes around return false but it doesn't resolve the issue. The example in Codex does in fact show quotes. https://codex.wordpress.org/Function_Reference/_return_false

I have opened a ticket in core tracker for this, possible bug.

3
  • what’s the link to the ticket you submitted?
    – Caleb
    Apr 26 '20 at 20:08
  • I'm still not seeing this issue as resolved. I have the disable code in my functions.php file and I just tested this again today 4/27/2020 - I uploaded a 3600 px wide image and it created both a 1536 and a 2048 image on my server.
    – Pitchpole
    Apr 27 '20 at 22:15
  • what's the link to the ticket in core tracker?
    – Caleb
    May 7 '20 at 15:06
1

Now it is working as expected (disabled scaling), under the following settings:

In my theme functions.php

add_filter( 'big_image_size_threshold', '__return_false' );

In the WP Media Settings:

enter image description here

1

I found a client's site where the filter wasn't working. I did a lot of testing on a sandbox site and the filter worked. The website in question is using the Avada theme. Avada has the threshold size built into the theme settings so you can customize what size you would like the scaled image to be. This was overriding where I was trying turn it off in my core plugin.

I first tried adding a priority to the add_filter of 9999 so it would hopefully run later but this doesn't seem to work in this instance (I'm still testing this). I set the threshold size to 0 in Avada and it successfully turned the big image scaling off.

I suggest try adding a priority to see if that helps. If not search the theme and the plugins to see if it is being set there. I know this can be difficult on a live site but I would try using one of the WP default themes and deactivating all the plugins to see if it works. Then reactivate the theme and plugins 1 by 1 to see if there is one causing the issue.

I have used this plugin to test this type of thing on live sites, WP-Staging

To remove the other sizes I found it wasn't enough to set the filter, you also need to unset the new sizes.

// Remove images sizes
function zgwd1010_filter_image_sizes( $sizes) {
    unset( $sizes['1536x1536']); // disable 2x medium-large size
    unset( $sizes['2048x2048']); // disable 2x large size
    return $sizes;
}
add_filter('intermediate_image_sizes_advanced', 'zgwd1010_filter_image_sizes');
0

I don't know why the __return_false doesns't work, but something like this does:

function gc_big_image_size_threshold( $threshold ) {
    return 9999; // new threshold
}
add_filter('big_image_size_threshold', 'gc_big_image_size_threshold', 100, 1);
-1

You need to remove the quotes around '__return_false'.

<?php
// Remove the quotes around __return_false
add_filter( 'big_image_size_threshold', __return_false); 

You are giving the function a string, hence the filter is not executing.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.