WordPress中内置了Gravatar头像,网上也没看到ASP的相关代码,但是很多BLOG和个人网站还是ASP的,老七就是其中一个。(Gravatar是什么?)
研究了一下,然后写了一个ASP嵌入Gravatar头像实例,有需要的朋友可以下载随便用,转载请链接本文地址,谢谢!
代码核心:
<!--#include file="md5.asp"-->
<%
set h = new MD5 '载入MD5实例
hash = h.hash(""&rs("email")"") '指定在Gravatar中的email地址
noPicUrl = server.urlEncode("http://localhost/no.jpg") '设定默认图片
%>
<img src=http://www.gravatar.com/avatar.php?gravatar_id=<%= hash %>&default=<%= noPicUrl %> />
演示地址: http://pcook.com.cn/demo/201004/ASPGravatar/
下载地址: http://pcook.com.cn/demo/201004/ASPGravatar/ASPGravatar.rar