Skip to content

Commit

Permalink
Merge pull request #16 from Hypercubed/master
Browse files Browse the repository at this point in the history
Made getImageSrc arguments optional
  • Loading branch information
lavinjj committed Feb 20, 2014
2 parents a83ce91 + 4834e5c commit 72533cb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/gravatar-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ angular.module('ui-gravatar', ['md5']).
getImageSrc : function(value, size, rating, defaultUrl, secure) {
// convert the value to lower case and then to a md5 hash
var hash = md5.createHash(value.toLowerCase());
var src = (secure ? 'https://secure' : 'http://www' ) + '.gravatar.com/avatar/' + hash + '?s=' + size + '&r=' + rating + '&d=' + defaultUrl;
var src = (secure ? 'https://secure' : 'http://www' ) + '.gravatar.com/avatar/' + hash;
if (size) src += '?s=' + size;
if (rating) src += '&r=' + rating;
if (defaultUrl) src += '&d=' + defaultUrl;
return src;
}
};
Expand Down

0 comments on commit 72533cb

Please sign in to comment.