大佬教程收集整理的这篇文章主要介绍了Typecho 将评论头像从Gravatar改成显示QQ头像,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
typecho评论默认显示的头像是Gravatar头像,我想改成这样的:
如果是QQ邮箱,就显示QQ头像,
如果不是,就使用随机头像。
在模板的comments.PHP文件中搜索@H_450_9@gravatar
@H_450_9@<span itemprop="image"><?PHP $number=$comments->mail; if(preg_match('|^[1-9]\d{4,11}@qq\.com$|i',$number)){ echo '<img src="https://q2.qlogo.cn/headimg_dl? bs='.$number.'&dst_uin='.$number.'&dst_uin='.$number.'&;dst_uin='.$number.'&spec=100&url_enc=0&referer=bu_interface&term_type=PC" width="46px" height="46px" style="border-radius: 50%;float: left;margin-top: 0px;margin-right: 10px;margin-bottom:-2px">'; }else{ echo '<img src="https://uploadbeta.com/api/pictures/random/?key=BingEverydayWallpaperPicture" width="46px" height="46px" style="border-radius: 50%;float: left;margin-top: 0px;margin-right: 10px;margin-bottom:-2px">'; } ?> </span>
上面的代码中的@H_450_9@https://uploadbeta.com/api/pictures/random/?key=BingEverydayWallpaperPicture是调用必应每日图片的接口。
同样也可以使用其他的api。
比如下面这几个:
接口: https://acg.toubiec.cn/random.php
来源于[项目]随机二次元图片API-已经开源 - 苏晓晴-温馨的技术博客
http://acg.bakayun.cn/randbg.php(6000+ | 东方project可选 | 多尺寸)
来源于⑨ACG —— 随机二次元图片API
http://www.dmoe.cc/random.php(1000+)出处(・ω・)ノ
来源于随机二次元图片API - 微尘博客
参考
typecho将Gravatar头像改为QQ头像 - kali博客
以上是大佬教程为你收集整理的Typecho 将评论头像从Gravatar改成显示QQ头像全部内容,希望文章能够帮你解决Typecho 将评论头像从Gravatar改成显示QQ头像所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。