Make WordPress Core

Changeset 31721


Ignore:
Timestamp:
03/11/2015 04:31:50 PM (10 years ago)
Author:
helen
Message:

Gravatars: Enable HiDPI versions for browsers that support srcset.

props iseulde.
see #22329.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/pluggable.php

    r31591 r31721  
    21752175    }
    21762176
    2177     $args['size']    = $size;
     2177    $args['size']    = (int) $size;
    21782178    $args['default'] = $default;
    21792179    $args['alt']     = $alt;
     
    22092209        return false;
    22102210    }
     2211
     2212    $url2x = get_avatar_url( $id_or_email, array_merge( $args, array( 'size' => $args['size'] * 2 ) ) );
    22112213
    22122214    $args = get_avatar_data( $id_or_email, $args );
     
    22332235
    22342236    $avatar = sprintf(
    2235         "<img alt='%s' src='%s' class='%s' height='%d' width='%d' %s/>",
     2237        "<img alt='%s' src='%s' srcset='%s' class='%s' height='%d' width='%d' %s/>",
    22362238        esc_attr( $args['alt'] ),
    22372239        esc_url( $url ),
     2240        esc_attr( "$url 1x, $url2x 2x" ),
    22382241        esc_attr( join( ' ', $class ) ),
    22392242        (int) $args['height'],
Note: See TracChangeset for help on using the changeset viewer.