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. Merge of [39617] to the 4.7 branch. Props gitlost. Fixes #39231. See #38594. Built from https://develop.svn.wordpress.org/branches/4.7@39633 git-svn-id: http://core.svn.wordpress.org/branches/4.7@39573 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7d1db9607d
commit
8a2525a88d
|
@ -221,14 +221,28 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
|
|||
$fallback_sizes = apply_filters( 'fallback_intermediate_image_sizes', $fallback_sizes, $metadata );
|
||||
|
||||
$sizes = array();
|
||||
$_wp_additional_image_sizes = wp_get_additional_image_sizes();
|
||||
|
||||
foreach ( $fallback_sizes as $s ) {
|
||||
$sizes[ $s ]['width'] = get_option( "{$s}_size_w" );
|
||||
$sizes[ $s ]['height'] = get_option( "{$s}_size_h" );
|
||||
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" );
|
||||
}
|
||||
|
||||
// Force thumbnails to be soft crops.
|
||||
if ( ! 'thumbnail' === $s ) {
|
||||
$sizes[ $s ]['crop'] = get_option( "{$s}_crop" );
|
||||
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.
|
||||
if ( ! 'thumbnail' === $s ) {
|
||||
$sizes[ $s ]['crop'] = get_option( "{$s}_crop" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7.1-alpha-39632';
|
||||
$wp_version = '4.7.1-alpha-39633';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue