mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 14:50:29 +00:00
REST API: Add support for continuing the post-processing of images after upload. Flow:
1. `POST /wp/v2/media`.
2. If the upload failed (HTTP 500 error), look for a response header with `X-WP-Upload-Attachment-ID` header that contains the newly created attachment ID.
3. `POST /wp/v2/media/{id}/post-process` with `{ "action": "create-image-subsizes" }`. This request may still fail, but it will save its progress.
4. On continued failure, `DELETE /wp/v2/media/{id}` to give up on the upload and instruct the user to resize their image before uploading.
Props TimothyBlynJacobs.
Fixes #47987.
git-svn-id: https://develop.svn.wordpress.org/trunk@46422 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1327,7 +1327,7 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$data = $response->get_data();
|
||||
$properties = $data['schema']['properties'];
|
||||
$this->assertEquals( 26, count( $properties ) );
|
||||
$this->assertEquals( 27, count( $properties ) );
|
||||
$this->assertArrayHasKey( 'author', $properties );
|
||||
$this->assertArrayHasKey( 'alt_text', $properties );
|
||||
$this->assertArrayHasKey( 'caption', $properties );
|
||||
@@ -1360,6 +1360,7 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control
|
||||
$this->assertArrayHasKey( 'raw', $properties['title']['properties'] );
|
||||
$this->assertArrayHasKey( 'rendered', $properties['title']['properties'] );
|
||||
$this->assertArrayHasKey( 'type', $properties );
|
||||
$this->assertArrayHasKey( 'missing_image_sizes', $properties );
|
||||
}
|
||||
|
||||
public function test_get_additional_field_registration() {
|
||||
|
||||
Reference in New Issue
Block a user