Where should I start if I want to integrate Gravatars for the users in my Java application?
Gravatar API for Java
You can use jgravatar and than just use methods like the once bellow:
import jgravatar.Gravatar;
import jgravatar.GravatarDefaultImage;
import jgravatar.GravatarRating;
public static String getGravatar160pxUrl(String email) {
Gravatar gravatar = new Gravatar();
gravatar.setSize(160);
gravatar.setRating(GravatarRating.GENERAL_AUDIENCES);
gravatar.setDefaultImage(GravatarDefaultImage.IDENTICON);
return gravatar.getUrl(email);
}
public static String getGravatar80pxUrl(String email) {
Gravatar gravatar = new Gravatar();
gravatar.setRating(GravatarRating.GENERAL_AUDIENCES);
gravatar.setDefaultImage(GravatarDefaultImage.IDENTICON);
return gravatar.getUrl(email);
}
if anyone interested, here comes Android version too...
hope this helps...
https://github.com/wareninja/gravatar-for-android
Android library for Gravatar stuff, current features;
- Load Gravatar image using AsyncTask
- Load and Parse Gravatar Profile using AsyncTask
Is there a reason no updates have been done in 2 years? Gravatar did not evolve? –
Moonfish
good question! well... it has been long time that I didn't check gravatar API, i'll revisit and see if any update needed. plz let me know if anything specific is needed, your contribution is also welcome –
Housewifery
may be you can use my gravatar4j (https://github.com/yingzhuo/gravatar4j)
just do this in you jsp
<%@ taglib prefix="gravatar4j" uri="https://github.com/yingzhuo/gravatar4j/functions" %>
and to this
<img alt="" src="${gravatar4j:from('[email protected]', 160)}">
'160' means size in pixels, by the way.
© 2022 - 2024 — McMap. All rights reserved.