Media: in wp_get_attachment_image_sizes(), ensure that $img_width exists when the image does not.

Props kraftbj.
See #33641.


Built from https://develop.svn.wordpress.org/trunk@35250


git-svn-id: http://core.svn.wordpress.org/trunk@35216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-10-17 22:12:24 +00:00
parent c7b0db99a6
commit 443ce28304
2 changed files with 3 additions and 3 deletions

View File

@ -1003,12 +1003,12 @@ function wp_get_attachment_image_srcset( $attachment_id, $size = 'medium' ) {
* @return string|bool A valid source size value for use in a 'sizes' attribute or false.
*/
function wp_get_attachment_image_sizes( $attachment_id, $size = 'medium', $args = null ) {
$img_width = 0;
// Try to get the image width from $args.
if ( is_array( $args ) && ! empty( $args['width'] ) ) {
$img_width = (int) $args['width'];
} elseif ( $img = image_get_intermediate_size( $attachment_id, $size ) ) {
list( $img_width, $img_height ) = image_constrain_size_for_editor( $img['width'], $img['height'], $size );
list( $img_width ) = image_constrain_size_for_editor( $img['width'], $img['height'], $size );
}
// Bail early if $image_width isn't set.

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-35249';
$wp_version = '4.4-alpha-35250';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.