// Check and set the output mime type mapped to the input type.
if ( isset( $args['mime_type'
] ) ) { /** This filter is documented in wp-includes/class-wp-image-editor.php */
$output_format =
apply_filters( 'image_editor_output_format', array
(),
$path,
$args['mime_type'
] );
if ( isset( $output_format[ $args['mime_type'
] ] ) ) { $args['output_mime_type'
] =
$output_format[ $args['mime_type'
] ];
} } $implementation =
_wp_image_editor_choose( $args );
if ( $implementation ) { $editor =
new $implementation( $path );
$loaded =
$editor->
load();
if ( is_wp_error( $loaded ) ) { return $loaded;
} return $editor;
}