Make WordPress Core


Ignore:
Timestamp:
10/07/2019 05:04:49 PM (5 years ago)
Author:
azaozz
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php

    r44933 r46422  
    13281328        $data       = $response->get_data();
    13291329        $properties = $data['schema']['properties'];
    1330         $this->assertEquals( 26, count( $properties ) );
     1330        $this->assertEquals( 27, count( $properties ) );
    13311331        $this->assertArrayHasKey( 'author', $properties );
    13321332        $this->assertArrayHasKey( 'alt_text', $properties );
     
    13611361        $this->assertArrayHasKey( 'rendered', $properties['title']['properties'] );
    13621362        $this->assertArrayHasKey( 'type', $properties );
     1363        $this->assertArrayHasKey( 'missing_image_sizes', $properties );
    13631364    }
    13641365
Note: See TracChangeset for help on using the changeset viewer.