实现的原理和实现办法如下:
首先,gravatar头像地址格式是:
http://cn.ravatar.com/avatar/6a4433c88a97f06e0a52bab7f22
后面的那一串是Gravatar使用的是MD5加密之后的Email字符串,因此只需要使用MD5把评论用户的邮箱加密成字符串,然后添加到
http://cn.ravatar.com/avatar/
然后即可调用该邮箱gravatar头像。
最后解决此问题的代码如下:
{php}
$avatar = md5(strtolower($comment->Author->Email));
{/php}
<img src="https://678pdf.com/assets/uploads/1788e8d15482e8d4272eb744815f2807.jpg" alt="{$comment.Author.StaticName}"/>$comment->Author->Email是评论用户邮箱代码