Media: Ignore errors coming from image_resize_dimensions()
when creating sub-sizes (for now). It returns false
when the requested size is larger than the original image and should be skipped. This triggers new WP_Error
in WP_Image_Editor::resize()
.
See #40439. git-svn-id: https://develop.svn.wordpress.org/trunk@45543 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
69fabdbd4d
commit
5e26728387
@ -235,12 +235,20 @@ function _wp_make_subsizes( $new_sizes, $file, $image_meta, $attachment_id ) {
|
|||||||
$new_size_meta = $editor->make_subsize( $new_size_data );
|
$new_size_meta = $editor->make_subsize( $new_size_data );
|
||||||
|
|
||||||
if ( is_wp_error( $new_size_meta ) ) {
|
if ( is_wp_error( $new_size_meta ) ) {
|
||||||
|
$error_code = $new_size_meta->get_error_code();
|
||||||
|
|
||||||
|
if ( $error_code === 'error_getting_dimensions' ) {
|
||||||
|
// Ignore errors when `image_resize_dimensions()` returns false.
|
||||||
|
// They mean that the requested size is larger than the original image and should be skipped.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ( empty( $image_meta['subsize_errors'] ) ) {
|
if ( empty( $image_meta['subsize_errors'] ) ) {
|
||||||
$image_meta['subsize_errors'] = array();
|
$image_meta['subsize_errors'] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$error = array(
|
$error = array(
|
||||||
'error_code' => $new_size_meta->get_error_code(),
|
'error_code' => $error_code,
|
||||||
'error_message' => $new_size_meta->get_error_message(),
|
'error_message' => $new_size_meta->get_error_message(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user