Skip to content

Commit

Permalink
Blavatar defaults to 404
Browse files Browse the repository at this point in the history
  • Loading branch information
nbradbury committed Feb 6, 2015
1 parent 9d58f07 commit f4ba322
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ public static String gravatarFromEmail(final String email, int size) {
+ "?d=mm&size=" + Integer.toString(size);
}

/*
* important: the 404 default means the request will 404 if there is no blavatar
* for the passed site - so the caller needs to trap the 404 to provide a default
*/
public static String blavatarFromUrl(final String url, int size) {
return "http://gravatar.com/blavatar/"
+ StringUtils.getMd5Hash(UrlUtils.getDomainFromUrl(url))
+ "?d=mm&size=" + Integer.toString(size);
+ StringUtils.getMd5Hash(UrlUtils.getDomainFromUrl(url))
+ "?d=404&size=" + Integer.toString(size);
}
}

0 comments on commit f4ba322

Please sign in to comment.