HTTP Error when uploading files above 7mb unless using GD Image Editor

by Hendeca   Last Updated June 22, 2018 21:08 PM

I noticed recently that when uploading files larger than 7mb to a Wordpress site that I developed, I get an HTTP Error. I've checked some of my PHP variables, and have verified that memory_limit is set to 256M and both post_max_size and upload_max_filesize are set to 128M. After reading this thread, I tried installing the Default to GD plugin that uses GD as the default WP_Image_Editor class.

After installing the plugin, I'm not having the issue anymore. That said, I'm curious if there's a way to fix this issue with the newer WP_Image_Editor class?

I've also noticed that when I get the HTTP error, I can look at the files attached to the post I added the file to and see that the file is actually there and was successfully uploaded. However, Wordpress seems to have issues displaying it in the Media browser.

I also noticed that if I upload multiple large images over 7mb, I will see the most recent image as the first item in the media library. If I delete that image, I'll see the next most recently uploaded image. For some reason Wordpress is only able to show the most recent image and the thumbnail seems to be broken. However if you navigate to the uploaded file's URI, you can see that the file uploaded successfully.

Does anyone have an idea what's going on with this and is this a known error in Wordpress that's being addressed? Thanks!

Answers 1

I sometimes get this exact same issue and set of symptoms.

It's caused by the image being too large for the memory available. Not the file size as that has compressed data, but the actual width x height x colourdepth.

You can see the full size image because it uploaded fine. You have trouble in the media browser because WP ran out of memory while scaling and cropping the image and so there is no version available for the media browser thumbnail.

I've always found that allocating much more memory to the process fixes it. Or use smaller images (dimensions, not file size).

Andy Macaulay-Brook
Andy Macaulay-Brook
June 22, 2018 20:40 PM

Related Questions

Upload images to remote server

Updated January 18, 2018 16:08 PM