How to fix gravatar not shown in china mainland?

Add this snippet to functions.php:

function dmeng_get_https_avatar($avatar) {
//replace domain
$avatar = str_replace(array("", "", "", ""), "", $avatar);
//replace protocol
$avatar = str_replace("http://", "https://", $avatar);
return $avatar;
add_filter('get_avatar', 'dmeng_get_https_avatar');

Contributed by dmeng

If visitors of your website is mainly from china mainland, there is a better way, duoshuo (a service similar to disqus) provides a mirror of gravatar, add this snippet to functions.php

//Replace Gravatar with duoshuo mirror
function mytheme_get_avatar($avatar) {
    $avatar = str_replace(array("","","",""),"",$avatar);
    return $avatar;
add_filter( 'get_avatar', 'mytheme_get_avatar', 10, 3 );

Could not know who contributed this method fist, thanks duoshuo!