Gravatar头像无法显示,下面是解决的办法!

当然,如果使用多说的话,可以忽略本文了。

找到/var/Widget/Abstract 下的 Comments.php 文件,将390行的gravatar函数换成下面的:

public function gravatar($size = 32, $default = NULL)
{
    if ($this->options->commentsAvatar && 'comment' == $this->type) {
        $rating = $this->options->commentsAvatarRating;
        
        $this->pluginHandle(__CLASS__)->trigger($plugged)->gravatar($size, $rating, $default, $this);
        if (!$plugged) {
            //$url = Typecho_Common::gravatarUrl($this->mail, $size, $rating, $default, $this->request->isSecure());
            $mailHash = NULL;
            if (!empty($this->mail)) {
            $mailHash = md5(strtolower($this->mail));
            }
            $url = 'https://secure.gravatar.com/avatar/';
            if (!empty($this->mail)) {$url .= $mailHash;}
            $url .= '?s=' . $size;
            $url .= '&r=' . $rating;
            $url .= '&d=' . $default;
            echo '<img class="avatar" src="' . $url . '" alt="' .
            $this->author . '" width="' . $size . '" height="' . $size . '" />';
        }
    }
}