Requested feature overview description.
require 'digest/md5' profileImage = Null #Greater than 0, aka: avatar is a post, and enableAvatars is equal to 1(Enable post avatars) if userFromID(id).userSettings[:avatar] > 0 and currentUser.userSettings[:enableAvatars] == 1 then profileImage = e621.getThumbnailURL(userSettings[:avatar]) maxRating = userFromID(id).userSettings[:profileAvatarMaxRating] #Do rating handling here write("<a href=\"${userSettings[:avatar]}\"><img src=\"${profileImage}\"/></a>") #Avatar is equal to -1, aka: gravatar, and enableAvatar is equal to 2(Enable gravatar avatars) elsif userFromID(id).userSettings[:avatar] == -1 and currentUser.userSettings[:enableAvatars] == 2 then email_address = params[:email].downcase hash = Digest::MD5.hexdigest(userSettings[:email].downcase) maxRating = userFromID(id).userSettings[:profileAvatarMaxRating] #Convert e621 ratings to Gravatar ratings: G, PG, R, X if maxRating == "S" then maxRating = "g" elif maxRating == "Q" then maxRating = "pg" elif maxRating == "E" then maxRating = "x" end profileImage = "https://www.gravatar.com/avatar/#{hash}?s=150&rating=#{maxRating}" write("<img src=\"${profileImage}\"/>") end
Why would it be useful?
People have been wanting to use custom avatars but are often deleted because of quality control. Gravatar solves this in multiple ways:
1) No need to add complicated upload mechanism to e621
2) Gravatar lets people upload what they want
The code(although probably improperly formatted) solves multiple issues too:
1) Users can choose to not see gravatar avatars and still see regular posts as avatar avatars
2) Users can choose only to see avatars of specific ratings
3) Bonus: users can also choose to see avatars of specific ratings on e621 now too
What part(s) of the site page(s) are affected?
- User profiles
- User posts
- User avatar
Updated by rysyN