From 8e804c5a1ab78d3e42fc0494c222dbdf7502933f Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Mon, 3 Feb 2014 18:03:12 -0500 Subject: [PATCH] retro default, better size for xs --- models/User.js | 9 +++++++-- views/account/profile.jade | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/models/User.js b/models/User.js index e3c87848f4..1c3969f880 100644 --- a/models/User.js +++ b/models/User.js @@ -49,10 +49,15 @@ userSchema.methods.comparePassword = function(candidatePassword, cb) { }); }; -userSchema.methods.gravatar = function() { +/** + * Get a url to a User's Gravatar email + */ +userSchema.methods.gravatar = function(size,defaults) { + if (!size) size = 200; + if (!defaults) defaults = 'retro'; var md5 = crypto.createHash('md5'); md5.update(this.email); - return 'https://gravatar.com/avatar/' + md5.digest('hex').toString() + '?s=200'; + return 'https://gravatar.com/avatar/' + md5.digest('hex').toString() + '?s='+size+'&d='+defaults; }; module.exports = mongoose.model('User', userSchema); diff --git a/views/account/profile.jade b/views/account/profile.jade index 02dfbee1c4..77136d706b 100644 --- a/views/account/profile.jade +++ b/views/account/profile.jade @@ -5,8 +5,8 @@ block content h3 Profile Information form.form-horizontal(action='/account/profile', method='POST') .row - .col-xs-2 - img(src="#{user.gravatar()}") + .col-md-2.col-xs-4 + img(src="#{user.gravatar()}", class='profile') small Change your photo at a(href="http://gravatar.com") Gravatar .col-xs-10