Media: Allow PDF fallbacks filter to process custom sizes.
This fixes an oversight in [39246], which added a hook for filtering the array of sizes used for PDF thumbnails, but failed to provide a way for sizes added through `add_image_size()` to be processed. Props gitlost. Fixes #39231. See #38594. Built from https://develop.svn.wordpress.org/trunk@39617 git-svn-id: http://core.svn.wordpress.org/trunk@39557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
15ddaa269e
commit
efb191c2ed
|
@ -221,16 +221,30 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
|
||||||
$fallback_sizes = apply_filters( 'fallback_intermediate_image_sizes', $fallback_sizes, $metadata );
|
$fallback_sizes = apply_filters( 'fallback_intermediate_image_sizes', $fallback_sizes, $metadata );
|
||||||
|
|
||||||
$sizes = array();
|
$sizes = array();
|
||||||
|
$_wp_additional_image_sizes = wp_get_additional_image_sizes();
|
||||||
|
|
||||||
foreach ( $fallback_sizes as $s ) {
|
foreach ( $fallback_sizes as $s ) {
|
||||||
|
if ( isset( $_wp_additional_image_sizes[ $s ]['width'] ) ) {
|
||||||
|
$sizes[ $s ]['width'] = intval( $_wp_additional_image_sizes[ $s ]['width'] );
|
||||||
|
} else {
|
||||||
$sizes[ $s ]['width'] = get_option( "{$s}_size_w" );
|
$sizes[ $s ]['width'] = get_option( "{$s}_size_w" );
|
||||||
$sizes[ $s ]['height'] = get_option( "{$s}_size_h" );
|
}
|
||||||
|
|
||||||
|
if ( isset( $_wp_additional_image_sizes[ $s ]['height'] ) ) {
|
||||||
|
$sizes[ $s ]['height'] = intval( $_wp_additional_image_sizes[ $s ]['height'] );
|
||||||
|
} else {
|
||||||
|
$sizes[ $s ]['height'] = get_option( "{$s}_size_h" );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset( $_wp_additional_image_sizes[ $s ]['crop'] ) ) {
|
||||||
|
$sizes[ $s ]['crop'] = $_wp_additional_image_sizes[ $s ]['crop'];
|
||||||
|
} else {
|
||||||
// Force thumbnails to be soft crops.
|
// Force thumbnails to be soft crops.
|
||||||
if ( ! 'thumbnail' === $s ) {
|
if ( ! 'thumbnail' === $s ) {
|
||||||
$sizes[ $s ]['crop'] = get_option( "{$s}_crop" );
|
$sizes[ $s ]['crop'] = get_option( "{$s}_crop" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Only load PDFs in an image editor if we're processing sizes.
|
// Only load PDFs in an image editor if we're processing sizes.
|
||||||
if ( ! empty( $sizes ) ) {
|
if ( ! empty( $sizes ) ) {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.8-alpha-39616';
|
$wp_version = '4.8-alpha-39617';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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