[wp-trac] [WordPress Trac] #47872: Try to create image sub-sizes again when uploading fails with a PHP fatal error

WordPress Trac noreply at wordpress.org
Tue Oct 22 16:43:00 UTC 2019


#47872: Try to create image sub-sizes again when uploading fails with a PHP fatal
error
-------------------------------------------------+-------------------------
 Reporter:  azaozz                               |       Owner:  azaozz
     Type:  enhancement                          |      Status:  closed
 Priority:  high                                 |   Milestone:  5.3
Component:  Upload                               |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch needs-testing has-         |     Focuses:
  screenshots close has-dev-note                 |
-------------------------------------------------+-------------------------

Comment (by azaozz):

 Replying to [comment:29 GregLone]:

 Right. The `wp_generate_attachment_metadata` will still fire on all
 (successful) image uploads that are completed during the original upload
 request, same as before. This is the most common case. If there was a PHP
 fatal error while creating image sub-sizes, that filter won't fire (won't
 be reached), again, same as before.

 Was thinking how to fire it, or add a new filter/action, for the cases
 where it initially fails and retrying to create image sub-sizes succeeds.
 One possibility is to add an action at the end of both
 `wp_create_image_subsizes()` and `wp_update_image_subsizes()`, something
 like `wp_image_subsizes_created`. However it still won't be able to pass
 the context, i.e. whether this is a new upload or regenerating the sub-
 sizes of an existing/old attachment, so it won't be very straightforward
 to use.

 Any better ideas? :)

 > what I believe are typos

 Thanks for catching these. One was removed and the other fixed in a
 follow-up ticket, see #48200.

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


More information about the wp-trac mailing list