Gravatar是Globally Recognized Avatar的缩写,是gravatar推出的一项服务,意为“全球通用头像”。如果在Gravatar的服务器上放置了你自己的头像,那么在任何支持Gravatar的blog或者留言本上留言时,只要提供你与这个头像关联的email地址,就能够显示出你的Gravatar头像
您可以使用以下格式的 URL 来加载头像 $hash 可以是邮箱的md5或者SHA256
'https://avatar.apiba.cn/avatar/' . $hash
PHP
function get_gravatar_url( $email ) {
// Trim leading and trailing whitespace from
// an email address and force all characters
// to lower case
$address = strtolower( trim( $email ) );
// Create an SHA256 hash of the final string
$hash = hash( 'sha256', $address );
// Grab the actual image URL
return 'https://avatar.apiba.cn/avatar/' . $hash;
}
本站使用Cloudflare Workers代理en.gravatar.com
如有问题,请联系 @Qicloud。