diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index 1e265d45f7..41efa0ad13 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -581,13 +581,18 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) { // Resize based on the full size image, rather than the source. if ( ! is_wp_error( $uploaded ) ) { - $editor = wp_get_image_editor( $uploaded['path'] ); + $image_file = $uploaded['path']; unset( $uploaded['path'] ); - if ( ! is_wp_error( $editor ) ) { - $metadata['sizes'] = $editor->multi_resize( $merged_sizes ); - $metadata['sizes']['full'] = $uploaded; - } + $metadata['sizes'] = array( + 'full' => $uploaded, + ); + + // Save the meta data before any image post-processing errors could happen. + wp_update_attachment_metadata( $attachment_id, $metadata ); + + // Create sub-sizes saving the image meta after each. + $metadata = _wp_make_subsizes( $merged_sizes, $image_file, $metadata, $attachment_id ); } } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 84a78d8d7b..3a7610c322 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-beta3-46458'; +$wp_version = '5.3-beta3-46459'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.