Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#54912 closed enhancement (invalid)

Image size limit is a bug not a feature

Reported by: jonfr2100's profile jonfr2100 Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.9
Component: Media Keywords:
Focuses: Cc:

Description

The current image size limit of 2000 x 1200 and maximum of 2500 pixels is a bug and limiting uses of WordPress. All cameras since 2010 take pictures that are at least 2700 x 2300 pixels. This limit prevents people from uploading images to their website and this limit should never have been put into WordPress from version 5.3. Most people are on good enough internet connection to deal with images sizes above 1024 x 1024. This needs to be changed back and people allowed to upload images of any size to their WordPress websites.

This limit needs to be removed or option allowed for it to be changed to modern image size that is often above 4000 x 3000, this is just most modern mobile phone image size.

Change History (6)

#1 @costdev
3 years ago

  • Keywords needs-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Type changed from defect (bug) to enhancement

Hi @jonfr2100!

There are indeed ways to modify or remove this threshold.

Option 1

Option 2

  1. Save the following towp-content/plugins/change_image_threshold/change_image_threshold.php (note the comments - use either the line or the block, not both).
    <?php
    
    /**
     * Plugin Name: Change image threshold
     */
    
    // Add this line to remove the threshold altogether.
    add_filter( 'big_image_size_threshold', '__return_false', 999 );
    
    // OR Add this block to change the threshold to 4000.
    add_filter(
            'big_image_size_threshold',
            function( $threshold ) {
                    return 4000;
            },
            999
    );
    
    
  2. Navigate to Plugins > Installed Plugins and activate "Change image threshold".

Option 3

  • Add the following to your theme's functions.php file to disable the threshold:
add_filter( 'big_image_size_threshold', '__return_false', 999 );

Once you have done one of the three options above, you can upload larger images to your website (assuming they are within the file size limit) and selecting "Full Size" in the editor will load the original file.

Note:

  • The image may not display at the full size if the website's styling limits this.
  • However, it will load the original file. You can verify this by right-clicking and selecting "Open image in new tab", or by linking the image to "Media File".

I'll close this ticket as the requested enhancement is indeed already available.

Last edited 3 years ago by costdev (previous) (diff)

#2 @SergeyBiryukov
3 years ago

  • Component changed from Gallery to Media

#3 @jonfr2100
3 years ago

I did try one of the plugins that are supposed to disable this image size limit. It no longer works because of internal changes with WordPress. To modify the code as is suggested is a bad practice and allows for errors or can break the installation, the changes are also removed on next update of WordPress.

#4 @costdev
3 years ago

As I don't know the context in which your site has been created, I provided three options for you to evaluate to suit your needs.

Modifying your theme's code would only be relevant if it was a custom theme, or a child theme, that you developed. In that context, if that was going to be your theme going forward and you weren't comfortable with plugin development, then it might have fitted your needs best. However, generally speaking, a plugin is a much safer option for this.

I added the above filter as a plugin and was able to upload a new image without it being scaled down to 2560px. I'm not sure why your results were different.

#5 follow-up: @jonfr2100
3 years ago

This is just bad practice that you are suggesting. I don't consider this a solution. It should not be WordPress job to limit upload sizes on private websites. It can be a option to use in a platforms that share many WordPress sites (free blogs and such). To deal with different users devices, images should just be cached into different thumbnails. Limiting upload sizes as is done from WordPress version 5.3.0 is a bad design decision. Since this forces people to downsize images down to 2000 x 1200 pixels or to do a manual upload, if that works. I have not tested that so far.

Plugins might work or they might not work, since it depends on often they are updated. The plugin you suggested didn't work because of changes in WordPress 5.9.0 compared to earlier version it seems.

#6 in reply to: ↑ 5 @knutsp
3 years ago

Replying to jonfr2100:

Plugins might work or they might not work, since it depends on often they are updated. The plugin you suggested didn't work because of changes in WordPress 5.9.0 compared to earlier version it seems.

The plugin suggested in option 2 above is a small plugin you create to solve the problem.

Note: See TracTickets for help on using tickets.