Gravatars: Enable HiDPI versions for browsers that support srcset.

props iseulde.
see #22329.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Helen Hou-Sandí 2015-03-11 16:32:26 +00:00
parent 4eba346517
commit 0bf35836c3
2 changed files with 6 additions and 3 deletions

View File

@ -2174,7 +2174,7 @@ function get_avatar( $id_or_email, $size = 96, $default = '', $alt = '', $args =
$args = array();
}
$args['size'] = $size;
$args['size'] = (int) $size;
$args['default'] = $default;
$args['alt'] = $alt;
@ -2209,6 +2209,8 @@ function get_avatar( $id_or_email, $size = 96, $default = '', $alt = '', $args =
return false;
}
$url2x = get_avatar_url( $id_or_email, array_merge( $args, array( 'size' => $args['size'] * 2 ) ) );
$args = get_avatar_data( $id_or_email, $args );
$url = $args['url'];
@ -2232,9 +2234,10 @@ function get_avatar( $id_or_email, $size = 96, $default = '', $alt = '', $args =
}
$avatar = sprintf(
"<img alt='%s' src='%s' class='%s' height='%d' width='%d' %s/>",
"<img alt='%s' src='%s' srcset='%s' class='%s' height='%d' width='%d' %s/>",
esc_attr( $args['alt'] ),
esc_url( $url ),
esc_attr( "$url 1x, $url2x 2x" ),
esc_attr( join( ' ', $class ) ),
(int) $args['height'],
(int) $args['width'],

View File

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