Home > Enterprise >  How to disable big image scaling in wordpress?
How to disable big image scaling in wordpress?

Time:07-30

I've been at this the whole day, a client wants to upload pictures to wordpress without having to resize them. Now this is the error I get when it's above the threshold which is 2560px.

The server cannot process the image. This can happen if the server is busy or does not have enough resources to complete the task. Uploading a smaller image may help. Suggested maximum size is 2560 pixels.

I've tried all the usual stuff that you see on various forums such as adding in function.php

add_filter( 'big_image_size_threshold', '__return_false' );

I also tried changing the threshold

 function test_image_threshold($imagesize, $file, $attachment_id){
    return 8000;
}
add_filter( 'big_image_size_threshold', 'test_image_threshold',10,3 );

I also tried disable big image threshold plugin which does not work and ultimately I tried messing with wp-admin/includes/image.php file and all I did was break the site.

I'm using 6.0.1 version of wordpress and this is starting to get really annoying. Does anyone know a fix for this so called feature in wordpress?

CodePudding user response:

This isn't a WordPress issue. Rather, it's an issue of the server itself. Your client is giving "too much work" for the server, there's (almost certainly) a timing out for the server, and then the uploading is simply being rejected. I'm guessing that the server is a shared hosting.

In order to make this work, the client would require more server power. Unless there's something I'm missing (which is quite possible), there's nothing you can do other than 1) get more server power or 2) have the images uploaded be resized.

CodePudding user response:

@Christopher Harlow you were partially right. As I thought that I am on apache2 server I was looking at apache2 server logs and they were empty. This morning I realized I am on nginx server and there I found that body size was too big so all I needed to do was add client_max_body_size 20M; in configuration and now add_filter( 'big_image_size_threshold', '__return_false' ); this piece of code works. Now it's all good.

  • Related