WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#24703 closed defect (bug) (duplicate)

No error message when memory_limit too low to complete upload compressing

Reported by: kb_unhammer Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5.2
Component: Media Keywords:
Focuses: Cc:

Description

To reproduce:

Set php.ini memory_limit to 50 M, upload a JPEG of width 3400 px or more using media-new.php. The upload progress bar goes to 100 %, says "Compressing …" but does not complete (on successful upload, the image icon and "Edit" link should show up).

With an image of exactly 3300 px width, however, I got an error message:

Fatal error: Allowed memory size of 94371840 bytes exhausted (tried to allocate 4096 bytes) in SITE/wp-includes/media.php on line 937

I tried 3400px, 3500px and so on up to 6000px and did not get any error messages, only the "Compressing …" text which never disappears. 3200 px or lower uploads fine. JPEG compression quality / file size of the uploaded file does not appear to have an effect.

My workaround was to increase the memory_limit so that my site could handle photos as large as my camera produces (now it bugs out on around 6000 px), but it took me several hours to figure out what was going on (uploading images of various sizes/qualities/file names) since there was no error message from Wordpress.

Note: the files _do_ seem to get uploaded, but if using the API, the client will not get back any message of the URL of the newly-uploaded file (it just gets an empty document back, in Python's wordpresslib I get a parse error).

I tried from the new media uploader in post-new.php too, here instead of stopping with the line "Compressing …", it shows a useless error message "Error foo.jpg: An error occurred in the upload. Please try again later."

Ideally Wordpress should
1) figure out that the memory_limit was reached even if the file had a very high resolution, and the error message should link to some documentation of methods to increase php.ini memory_limit
2) not use so much memory on compressing jpeg's

Change History (1)

#1 @SergeyBiryukov
8 years ago

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

Duplicate of #23127.

Note: See TracTickets for help on using tickets.