Gravatar API for Java
Asked Answered
P

3

8

Where should I start if I want to integrate Gravatars for the users in my Java application?

Phenice answered 18/1, 2011 at 4:34 Comment(0)
B
17

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);
}
Bria answered 18/1, 2011 at 4:37 Comment(0)
H
3

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
Housewifery answered 25/4, 2011 at 12:45 Comment(2)
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 welcomeHousewifery
L
2

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.

Latt answered 16/9, 2013 at 10:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.