Gravatar's profile picture is now a common method for calling blogs. many of my friends' personal blogs use Gravatar's profile picture, but recently many webmasters have found it slow to open Gravatar's profile picture, so how can we solve the problem of Gravatar Image playing... gravatar's profile picture is now a common method for calling blogs. many of my friends' personal blogs use Gravatar's profile picture, but recently many webmasters have found it slow to open Gravatar's profile picture, so how can we solve the problem that Gravatar images cannot be opened or are opened slowly? Let's take a look.
First, if we still need to use the Gravatar Avatar
Add the above code to the FUNCTIONS. PHP page of the current WORDPRESS topic. because HTTP cannot be accessed directly, it is changed to the HTTPS path address.
2. use a local Avatar
function my_avatar($avatar) { $tmp = strpos($avatar, 'http'); $g = substr($avatar, $tmp, strpos($avatar, "'", $tmp) - $tmp); $tmp = strpos($g, 'avatar/') + 7; $f = substr($g, $tmp, strpos($g, "?", $tmp) - $tmp); $w = get_bloginfo('wpurl'); $e = ABSPATH .'avatar/'. $f .'.jpg'; $t = 1209600; if ( !is_file($e) || (time() - filemtime($e)) > $t ) { copy(htmlspecialchars_decode($g), $e); } else{ $avatar = strtr($avatar, array($g => $w.'/avatar/'.$f.'.jpg')); } if (filesize($e) < 500) { copy($w.'/avatar/default.jpg', $e); } return $avatar;}add_filter('get_avatar', 'my_avatar');
Images are displayed as pictures that do not exist by default.
Third, use third-party comment plug-ins
Third-party comment plug-ins can be used to display portraits. Currently, there is no call problem. I have previously written an article titled "comment on four social comment systems ", currently, many users are still talking about it. The former provides a good user experience, that is, the server downtime is unstable. The latter is based on Sohu's interface, but the server is relatively stable.
Address:
Reprinted at will, but please attach the article address :-)