Media: Update fallback previews to support `_wp_make_subsizes()`
Allows fallback previews (PDF by default, in core) to save image meta after each size is generated to allow for resuming, and make sizes immediately available. Props azaozz, antpb, progremzion, mikeschroder. See #48111. Built from https://develop.svn.wordpress.org/trunk@46459 git-svn-id: http://core.svn.wordpress.org/trunk@46257 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
742537ac3d
commit
66c8085fc4
|
@ -581,13 +581,18 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
|
||||||
|
|
||||||
// Resize based on the full size image, rather than the source.
|
// Resize based on the full size image, rather than the source.
|
||||||
if ( ! is_wp_error( $uploaded ) ) {
|
if ( ! is_wp_error( $uploaded ) ) {
|
||||||
$editor = wp_get_image_editor( $uploaded['path'] );
|
$image_file = $uploaded['path'];
|
||||||
unset( $uploaded['path'] );
|
unset( $uploaded['path'] );
|
||||||
|
|
||||||
if ( ! is_wp_error( $editor ) ) {
|
$metadata['sizes'] = array(
|
||||||
$metadata['sizes'] = $editor->multi_resize( $merged_sizes );
|
'full' => $uploaded,
|
||||||
$metadata['sizes']['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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue