[wp-trac] [WordPress Trac] #23127: Media Upload hangs on Crunching on too big image sizes.

WordPress Trac noreply at wordpress.org
Sun Jan 6 08:46:09 UTC 2013


#23127: Media Upload hangs on Crunching on too big image sizes.
--------------------------+------------------------------
 Reporter:  clubdesign    |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Upload        |     Version:  3.5
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------
Description changed by SergeyBiryukov:

Old description:

> If the uploaded file is too big for the Max Memory Limit Setting, then
> the upload is executed, but the image isn`t resized to the set image
> sizes and the frontend get`s stuck on "Crunching". I tracked the error
> down into the core and found out, that the main problem is in the GD
> library class ( wp-includes/class-wp-image-editor-gd.php ) in the load()
> function.
>
> Everything works fine before line 91:
> {{{
> $this->image = @imagecreatefromstring( file_get_contents( $this->file )
> );
> }}}
>
> So imagecreatefromstring fails because of a lack of memory. But as a
> chain reaction everything else fails afterwards. The library is not
> loaded and sent back, and so on. As a result no id is sent back to the
> frontend and the Loader hangs.
>
> Maybe there should be any error catching and sending back before this GD
> function, that the frontend receives any error messages and that the
> upload is deleted in case of error.
>
> Just my thoughts: As this error is a Fatal one, you can`t use any
> Exception stuff, cause there will not be any memory left to execute it.
> Maybe some checking if the id is present before sending the image back to
> crunching?

New description:

 If the uploaded file is too big for the Max Memory Limit Setting, then the
 upload is executed, but the image isn't resized to the set image sizes and
 the frontend gets stuck on "Crunching". I tracked the error down into the
 core and found out, that the main problem is in the GD library class ( wp-
 includes/class-wp-image-editor-gd.php ) in the load() function.

 Everything works fine before line 91:
 {{{
 $this->image = @imagecreatefromstring( file_get_contents( $this->file ) );
 }}}

 So imagecreatefromstring fails because of a lack of memory. But as a chain
 reaction everything else fails afterwards. The library is not loaded and
 sent back, and so on. As a result no id is sent back to the frontend and
 the Loader hangs.

 Maybe there should be any error catching and sending back before this GD
 function, that the frontend receives any error messages and that the
 upload is deleted in case of error.

 Just my thoughts: As this error is a Fatal one, you can`t use any
 Exception stuff, cause there will not be any memory left to execute it.
 Maybe some checking if the id is present before sending the image back to
 crunching?

--

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23127#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list