Skip to content

Commit

Permalink
Media, REST API: Allow media edit endpoint to find remote files.
Browse files Browse the repository at this point in the history
Props jonsurrell.
Fixes #50595.

git-svn-id: https://develop.svn.wordpress.org/trunk@48386 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
azaozz committed Jul 7, 2020
1 parent dd353bf commit 7377c28
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -460,7 +460,15 @@ public function edit_media_item( $request ) {
);
}

$image_editor = wp_get_image_editor( $image_file );
// If the file doesn't exist, attempt a URL fopen on the src link.
// This can occur with certain file replication plugins.
// Keep the original file path to get a modified name later.
$image_file_to_edit = $image_file;
if ( ! file_exists( $image_file_to_edit ) ) {
$image_file_to_edit = _load_image_to_edit_path( $attachment_id );
}

$image_editor = wp_get_image_editor( $image_file_to_edit );

if ( is_wp_error( $image_editor ) ) {
return new WP_Error(
Expand Down

0 comments on commit 7377c28

Please sign in to comment.