一个头像, 一切无处不在。
const md5 = require( 'md5' );
function getGravatarURL( email ) {
// Trim leading and trailing whitespace from
// an email address and force all characters
// to lower case
const address = String( email ).trim().toLowerCase();
// Create an MD5 hash of the final string
const hash = md5( address );
// Grab the actual image URL
return `https://www.gravatar.cn/avatar/${ hash }`;
}
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 MD5 hash of the final string
$hash = md5( $address );
// Grab the actual image URL
return 'https://www.gravatar.cn/avatar/' . $hash;
}
头像调用方法:
https://www.cnavatar.com/avatar/md5(你的邮箱)
如我的头像是
https://www.cnavatar.com/avatar/6cce1b36478bd54ca9d0c7b5667c04fe
已经将gravatar.com改为cnavatar.com的gitblit.jar下载: