[wp-trac] [WordPress Trac] #48522: Attachment size not generated when large images uploaded

WordPress Trac noreply at wordpress.org
Mon Nov 11 19:09:24 UTC 2019


#48522: Attachment size not generated when large images uploaded
-------------------------------+---------------------
 Reporter:  vanyukov           |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  5.3.1
Component:  Media              |     Version:  trunk
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+---------------------

Comment (by azaozz):

 Replying to [comment:7 vanyukov]:
 > the {{{wp_ajax_media_create_image_subsizes()}}} is not triggered on my
 test install.

 What requests do you see in the browser tools network tab?

 There should be one to `async-upload.php` that will end with an HTTP 5.x.x
 error when the server runs out of resources. That should trigger an
 `admin-ajax.php` request which is the first retry attempt. If that also
 ends with HTTP 5.x.x error, another one should follow, up to four times.
 Finally if all retries fail there should be another `admin-ajax.php`
 request to do a "cleanup" of the failed upload. That should delete the
 newly created attachment and show the error message "...please scale down
 the image and try to upload again".

 > A possible solution would be to generate attachments from smallest to
 largest.

 This is already the case. The image sub-sizes are sorted by "usage
 priority" in `wp_create_image_subsizes()`. However if generating a
 registered sub-size fails, the upload is deemed unsuccessful. This may
 change in the future but keep in mind that currently there are five
 attempts to generate the sub-sizes. If all fail, chances are that the
 image cannot be resizes as uploaded and best next step would be for the
 user to scale it down and try uploading again.

 Eventually these retries can be "exposed" to the users by having a
 "partial" status for attachments with some UI/a button to retry to create
 the missing sub-sizes. But that will bring more complexity and in most
 cases will still fail at the end. Thinking that for now that can be added
 by plugins. If such plugins become popular, can perhaps be merged to core
 :)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48522#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list