gravatar

Simple class to generate Gravatar URL from a email-address.

License

License

GroupId

GroupId

org.rjung.util
ArtifactId

ArtifactId

gravatar
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

gravatar
Simple class to generate Gravatar URL from a email-address.
Project URL

Project URL

http://rynr.github.io/gravatar
Source Code Management

Source Code Management

http://github.com/rynr/gravatar

Download gravatar

How to add to project

<!-- https://jarcasting.com/artifacts/org.rjung.util/gravatar/ -->
<dependency>
    <groupId>org.rjung.util</groupId>
    <artifactId>gravatar</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.rjung.util/gravatar/
implementation 'org.rjung.util:gravatar:1.0'
// https://jarcasting.com/artifacts/org.rjung.util/gravatar/
implementation ("org.rjung.util:gravatar:1.0")
'org.rjung.util:gravatar:jar:1.0'
<dependency org="org.rjung.util" name="gravatar" rev="1.0">
  <artifact name="gravatar" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.rjung.util', module='gravatar', version='1.0')
)
libraryDependencies += "org.rjung.util" % "gravatar" % "1.0"
[org.rjung.util/gravatar "1.0"]

Dependencies

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.hamcrest : hamcrest-core jar 1.3

Project Modules

There are no modules declared in this project.

gravatar

Simple class to generate Gravatar URL for a email-address.

Usage:

import org.rjung.util.Gravatar;

class GravatarExample {
  public void main(String[] args) {
    System.out.println(Gravatar.forEmail("[email protected]").toUrl());
  }
}

There are other parameters you can set for the generation, like size, Default and Rating.
Default gives a alternative to the default gravatar-default-image, if no gravatar is defined.
To define a Rating or Default, add the information before you build the url using toUrl().
If you need a https-URL, you can also set the protocol via with(Protocol). There are three Protocol-definitions, HTTP provides a http://..-url, accordingly HTTPS provides the https://..-url. The default is NONE, the url now starts with ://.., a browser will choose the same protocol as currently used.

import org.rjung.util.Gravatar;
import org.rjung.util.gravatar.Default;
import org.rjung.util.gravatar.Protocol;
import org.rjung.util.gravatar.Rating;

class GravatarExample {
  public void main(String[] args) {
    System.out.println(
      Gravatar.forEmail("[email protected]")
          .with(Protocol.HTTPS)     // prepend https://
          .size(123)                // set the size to 123 pixel
          .defaultImage(Default.MM) // if not available show mystery man image
          .with(Rating.X)           // set rating to X
          .toUrl());
  }
}

Links:

Versions

Version
1.0
0.1