Ruby 图像请求

# include MD5 gem, should be part of standard ruby install
require 'digest/md5'
 
# get the email from URL-parameters or what have you and make lowercase
email_address = params[:email].downcase
 
# create the md5 hash
hash = Digest::MD5.hexdigest(email_address)
 
# compile URL which can be used in <img src="RIGHT_HERE"...
image_src = "https://cravatar.cn/avatar/#{hash}"

文档最后修改于

文派文库团队编撰