Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link with gravatar for a user account to pull their profile picture #253

Open
NathanCheshire opened this issue Feb 9, 2023 · 3 comments
Assignees

Comments

@NathanCheshire
Copy link
Owner

NathanCheshire commented Feb 9, 2023

JGravatar library for interaction with Gravatar.com is a bit outdated. We could make our own library separate from Cyder and pull it in with Gradle. Then others could easily use it, submit PRs, etc.

Notes:
Use builder pattern for API parameters
https://www.gravatar.com/avatar/HASH
.jpg sometimes required
default size is 80x80, allow customizing with config
?s=200
1-2048px range is valid
can supply own url to default image: ?d=https%3A%2F%2Fexample.com%2Fimages%2Favatar.jpg
d=404,mp,identicon,monsterid,wavatar,retro,robohash,blank are also valid options
force default image to always load: ?f=y
ratings: g, pg, r, x, can combine: g or pg use ?r=pg

@NathanCheshire NathanCheshire self-assigned this Feb 9, 2023
@NathanCheshire
Copy link
Owner Author

https://en.gravatar.com/site/implement/hash/ instructions for hash. Link to documentation in source code so that if people want to PR, they know where an assumption originally came from.

@NathanCheshire
Copy link
Owner Author

NathanCheshire commented Feb 9, 2023

/**
* A url parameter for a Gravatar request.
*/
public enum GravatarParameter {
    /**
    * The hash for a Gravatar request.
    */
    HASH(true),

    /**
    * The size of the image to be returned.
    */
    SIZE,

    /**
    * The URL to the default image to return in the case of a hash lookup failure.
    */
    DEFAULT_URL,

    /**
    * Whether to force the default url regardless of whether the hash can be located.
    */
    FORCE_DEFAULT,

    /**
    * The {@link GravatarDefaultPreset} type. Used to return a random custom avatar if a hash cannot be located.
    */
    DEFAULT_PRESET,

    /**
    * The default image URL a Gravatar request.
    */
    DEFAULT_IMAGE_URL,

    /**
    * The {@link GravatarRating} for a Gravatar request.
    */
    RATING;

    /**
    * Whether this URL parameter is required for a Gravatar request.
    */
    private final boolean required;

    GravatarParameter() {
        this(false);
    }

    GravatarParameter(boolean required) {
        this.required = required;
    }
}

@NathanCheshire
Copy link
Owner Author

NathanCheshire commented Feb 9, 2023

https://en.gravatar.com/205e460b479e2e5b48aec07710c08d50.json can also get json data about a user
https://en.gravatar.com/site/implement/profiles/ for more information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant