新手问题 使用 gravatar_image_tag 图片怎么命名?

limkurn · January 26, 2013 · Last by limkurn replied at January 27, 2013 · 2560 hits

我在 app/assets/images 把图片命名为 [email protected] [email protected] [email protected] 页面加载的还是默认的图像。该怎么命名才行?

module ApplicationHelper
  def avatar_url(user)
    default_url = "http://c-walkculture.com/public/style_images/elegant-blue/_custom/welcome_guest.png"
    gravatar_id = Digest::MD5.hexdigest(user.email.downcase)
    "http://gravatar.com/avatar/#{gravatar_id}.png?s=48&d=#{CGI.escape(default_url)}"
  end
end

#1 楼 @ericguo 这个我再 railscast 上看了 用户头像的图片是不是不是再本地的/images,而是传到了http://gravatar.com/avatar 上?

是,这个头像是用户托管在 Gravatar 的,和 email 对应的。

#3 楼 @ericguo 是说怎么再 images 下 命名都不行 谢了 我再仔细去看看怎么托管头像。

You need to Sign in before reply, if you don't have an account, please Sign up first.