Make WordPress Core


Ignore:
Timestamp:
07/07/2020 04:49:30 PM (4 years ago)
Author:
azaozz
Message:

Media, REST API: Allow media edit endpoint to find remote files.

Props jonsurrell.
Fixes #50595.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

    r48291 r48386  
    461461        }
    462462
    463         $image_editor = wp_get_image_editor( $image_file );
     463        // If the file doesn't exist, attempt a URL fopen on the src link.
     464        // This can occur with certain file replication plugins.
     465        // Keep the original file path to get a modified name later.
     466        $image_file_to_edit = $image_file;
     467        if ( ! file_exists( $image_file_to_edit ) ) {
     468            $image_file_to_edit = _load_image_to_edit_path( $attachment_id );
     469        }
     470
     471        $image_editor = wp_get_image_editor( $image_file_to_edit );
    464472
    465473        if ( is_wp_error( $image_editor ) ) {
Note: See TracChangeset for help on using the changeset viewer.