diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index 5f7b583d5d..4ae53b9c3a 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -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" ); + } } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 988da4434b..0859fe830a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @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.