[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
Mon Aug 19 20:51:23 UTC 2019
#47872: Try to create image sub-sizes again when uploading fails with a PHP fatal
error
----------------------------------------------------+---------------------
Reporter: azaozz | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 5.3
Component: Upload | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-testing needs-dev-note | Focuses:
----------------------------------------------------+---------------------
Comment (by azaozz):
There is an alternative way I've been testing, noting it here for
completeness. Instead of sending an "upload reference" with the upload
request, it could try to respond with the new attachment_id right after
the attachment was created and "flush" the PHP output (using
`fastcgi_finish_request()`), and continue making image sub-sizes in the
background.
That would provide a bit better "responsiveness" in the UI but comes with
some strings attached: no sub-size will be immediately available. This
method would need quite a lot more "processing logic" in the client. For
example if the user just wants to insert an image into a post the client
would have to use the original image at first, then request a particular
size, and if it was created, replace the image.
If the required sub-size is not yet created, the client will have to try
again later. That process may take quite long on slow/busy servers, 30
seconds or more. In the background if PHP fails to make all sub-sizes, we
can re-try on the subsequent requests from the client (as we know the
attachment_id). A pretty complex case would be when the users don't wait
that long and close the browser or navigate away. Then all the "replace"
logic should happen after the fact on the server, perhaps with a cron job,
etc.
From a purely UI/UX perspective thinking that waiting until all sub-sizes
are created (the current behaviour) makes more sense. Then all sub-sizes
will be available and the users can pick the one they need. When uploading
a file, it takes some time and the users expect that. Largely that time
will be for the actual upload to go through, not for creating the sub-
sizes.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47872#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list