REST API, Media: Add X-WP-Upload-Attachment-ID
HTTP header to enable retrying of post-processing of edited images if the server runs out of resources. This is the same as after uploading a new image, will do up to five additional requests to let the server create all image sub-sizes.
Fixes #50711. git-svn-id: https://develop.svn.wordpress.org/trunk@48525 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2daa951685
commit
fcc52436cb
@ -581,6 +581,12 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
|||||||
update_post_meta( $new_attachment_id, '_wp_attachment_image_alt', wp_slash( $image_alt ) );
|
update_post_meta( $new_attachment_id, '_wp_attachment_image_alt', wp_slash( $image_alt ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
|
||||||
|
// Set a custom header with the attachment_id.
|
||||||
|
// Used by the browser/client to resume creating image sub-sizes after a PHP fatal error.
|
||||||
|
header( 'X-WP-Upload-Attachment-ID: ' . $new_attachment_id );
|
||||||
|
}
|
||||||
|
|
||||||
// Generate image sub-sizes and meta.
|
// Generate image sub-sizes and meta.
|
||||||
$new_image_meta = wp_generate_attachment_metadata( $new_attachment_id, $saved['path'] );
|
$new_image_meta = wp_generate_attachment_metadata( $new_attachment_id, $saved['path'] );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user