Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#36677 closed defect (bug) (invalid)

WP 4.5.1 severely limits image upload size to under 2 MB

Reported by: pixeldrummer's profile Pixeldrummer Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5.1
Component: Media Keywords: reporter-feedback
Focuses: Cc:

Description

Just noticed the automatic update WP 4.5.1 in the two sites I did update to 4.5. At first I checked if another bug I reported was fixed: https://core.trac.wordpress.org/ticket/36523. I was able to insert full-sized images into page/posts. It worked for 2 out of 3 images. The new problem is that I could not upload any images that were larger than 2MB. I tried different sizes and anything over 2 MB produced an error (attached). I could reproduce this in both of the sites with WP 4.5.1.

When I went to other sites, which I did not update to WP 4.5 (or 4.5.1) I could upload images of any (reasonable) size, the largest of them was over 3.5 MB.

So, if you work a lot with images, the Media Library is still not back to stable.

Attachments (3)

media-file-size-error.jpg (10.7 KB) - added by Pixeldrummer 8 years ago.
Upload image file size error
broken-image.jpg (4.4 KB) - added by Pixeldrummer 8 years ago.
broken image in editor
broken-image-in-preview.jpg (4.4 KB) - added by Pixeldrummer 8 years ago.
broken-image-in-preview

Download all attachments as: .zip

Change History (17)

@Pixeldrummer
8 years ago

Upload image file size error

#1 @Pixeldrummer
8 years ago

Regarding inserting a full-size image into a page/post, this problem still exists. After you upload an image it does show in the media library, but when you insert it at native size into a post it appears as a broken link, see attachments. After editing the image (scale) and updating, you need to remove the (broken) image and re-insert, then it appears.

@Pixeldrummer
8 years ago

broken image in editor

@Pixeldrummer
8 years ago

broken-image-in-preview

#2 @azaozz
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

I'm assuming this is your local/test install? The 2mb upload size limit is a PHP default setting, edit php.ini and increase upload_max_filesize and post_max_size. If this is a production site, contact your hosting company.

Closing as worksforme, feel free to reopen with steps to reproduce if this is indeed a WordPress bug.

Last edited 8 years ago by azaozz (previous) (diff)

#3 @Pixeldrummer
8 years ago

No, this is not a PHP default setting. The ISP I work for does not have this limitation. And I can reproduce this error every time for installations that have updated to WP 4.5.1. Installations that have not updated to WP 4.5 (I stopped updating when errors appeared) don't produce this error. The server configurations are the same.

In further tests though I have found that this error appears when the WP version is 4.5.1 AND the active Theme is X. So, I have posted at the X-Theme forum as well.

I have posted here as WP 4.5 is the first substantial upgrade in years that has caused us serious problems that many users would not know how to work-around. While now knowing that this occurs when using X-theme, it may be still be an incompatibility that affects sites that use themes other than X.

Last edited 8 years ago by Pixeldrummer (previous) (diff)

#4 follow-ups: @azaozz
8 years ago

  • Keywords reporter-feedback added
  • Milestone set to Awaiting Review
  • Resolution worksforme deleted
  • Status changed from closed to reopened

Thanks for the explanation.

I've assumed this was a PHP configuration problem as the error message and the limit match exactly the (old) default in PHP. Could you check what are the values of upload_max_filesize and post_max_size to rule them out. Also, could you experiment with several different themes (including the default Twenty *) to confirm if this is caused only by that theme or is more common.

I know there were some problems with Imagick using more memory while resizing uploaded images, but then PHP will run out of memory and the error message will be different.

#5 follow-up: @Clorith
8 years ago

There's also the upload_size_limit_filter() which defaults to about 1.5MB, granted this function is (by default) only invoked on multisite, what kind of setup are you running on your sites?

I did test and I can upload images just fine on 4.5 and 4.5.1, but I get that error if I intentionally lower the limit on my site in multisite for testing purposes.

#6 in reply to: ↑ 4 @Pixeldrummer
8 years ago

Will check with our server people re: upload_max_filesize and post_max_size, as far as I know they are set to 32 MB and are occasionally increased to 64 MB, I'll confirm.

Am not running multi-site and have tested with themes other than X and the problem did not appear, only on the 3 sites I updated with X. These are live sites, some large, cannot test with any twenty *. The file size problem only appeared after updating to WP 4.5.1. I'll post back with the filesize settings.

Replying to azaozz:

Thanks for the explanation.

I've assumed this was a PHP configuration problem as the error message and the limit match exactly the (old) default in PHP. Could you check what are the values of upload_max_filesize and post_max_size to rule them out. Also, could you experiment with several different themes (including the default Twenty *) to confirm if this is caused only by that theme or is more common.

I know there were some problems with Imagick using more memory while resizing uploaded images, but then PHP will run out of memory and the error message will be different.

#7 in reply to: ↑ 5 @Pixeldrummer
8 years ago

Thanks for your reply. Am not running multisite and this problem only shows up on sites with the X-theme active and with WP version 4.5.1. Had no problems before this update with any file/image uploads. There was some other weirdness, all directly pointing to media library and image handling, not seen before the WP update to 4.5.

Replying to Clorith:

There's also the upload_size_limit_filter() which defaults to about 1.5MB, granted this function is (by default) only invoked on multisite, what kind of setup are you running on your sites?

I did test and I can upload images just fine on 4.5 and 4.5.1, but I get that error if I intentionally lower the limit on my site in multisite for testing purposes.

#8 in reply to: ↑ 4 @Pixeldrummer
8 years ago

This in reply to your request for values, upload_max_filesize and post_max_size from our server admin:
...public policy is 10M, goodman is 32M, civitas is showing 10M. That would mean that there's no way the php.ini setting is going to be limiting uploads to 2M. Even accounting for the fact that base64 encoding increases the size by roughly 33%, even the 10M limits should allow more than 6MB even if the raw post size is getting limited rather than the real file size.

Replying to azaozz:

Thanks for the explanation.

I've assumed this was a PHP configuration problem as the error message and the limit match exactly the (old) default in PHP. Could you check what are the values of upload_max_filesize and post_max_size to rule them out. Also, could you experiment with several different themes (including the default Twenty *) to confirm if this is caused only by that theme or is more common.

I know there were some problems with Imagick using more memory while resizing uploaded images, but then PHP will run out of memory and the error message will be different.

#9 @jasonwhite99
8 years ago

  • Keywords needs-patch added

I have a problem in 4.5.1 that it won't accept any JPG into the media gallery if the image has EXIF metadata, or larger than 2MB. Currently thinking of maybe upgrading the PHP version, but there's nothing in the current configuration that would cause the problems I'm having now. Uploading an image with metadata gets an HTTP Error. Image over 2MB gets the "image too large" error.

I've reinstalled the current WP version and looked the php.ini up and down... nothing.

#10 @Pixeldrummer
8 years ago

Am not sure where this ticket stands. There are two two issues. One is the limited upload file size, which is still occurring in my sites when using the X-theme.

The other is the full-size image bug. When inserting an image into a post the default is the medium size. If you want to change it to full-size, the image does not show, or shows as a broken image link. When you edit that image and crop it slightly, then remove the 'broken' image from the post and insert the edited/cropped full-size image it works. That I can reproduce every time.

Are both of these issues being addressed?

#11 @Clorith
8 years ago

  • Keywords needs-patch removed

As the problem only seems to exist when using your theme, I am going to have to defer you to the theme creators and their own support system (it's a premium theme, we don't have access to it so debugging it with you isn't really something we can do).

What is often the case though, is that the theme registers a large amount of image sizes, and WordPress is timing out while trying to create them all when the image size is too large.

It's strange that this only started happening for you with 4.5 though, and I would welcome the X-theme creators to chime in on that after they've done some debugging.

#12 follow-up: @Pixeldrummer
8 years ago

We found the problem with upload file size bug. It is a Wordfence NOT an X-theme bug. The new Wordfence firewall puts a line into .htaccess that causes this problem, an incompatibility with our servers. The Wordfence updates coincided with WP updates. As soon as we reverted (several sites) to the backed up .htaccess and turned off the firewall all errors disappeared. I thought I should name the correct culprit. It's not the X-theme.

#13 in reply to: ↑ 12 @joemcgill
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from reopened to closed

Thanks for the update @Pixeldrummer, glad to know you were able to get this resolved. I would be interested in knowing what they were adding to your .htaccess file that caused the original issue.

#14 @Pixeldrummer
8 years ago

@joemcgill here you are:

# Wordfence WAF
# remove idiocy added by the author of wordfence
#<IfModule mod_suphp.c>
#	suPHP_ConfigPath '/home/web/giweb/bigbusywebsite.org'
#</IfModule>
<Files ".user.ini">
<IfModule mod_authz_core.c>
	Require all denied ... 
Note: See TracTickets for help on using tickets.