Happy !

TorstenBergmann / Gravatar

Project infos

License MIT
Tags
Creation date 2014-04-23
Website

Monticello registration

About Gravatar

Gravatar

Project info

The "Gravatar" project is a simple wrapper for the Gravatar API allowing you to get small avatar images for a given registered email address. You can easily access and use it in Pharo.

Project location

The project is located on STHub at http://smalltalkhub.com/#!/~TorstenBergmann/Gravatar

License

The Gravatar project for Pharo is under MIT License.

Installation

To install just open the Pharo configuration browser and load "Gravatar" from there.

Alternatively to install the packages manually into your Pharo image just evaluate:

Gofer new
    url: 'http://smalltalkhub.com/mc/TorstenBergmann/Gravatar/main';
    package: 'ConfigurationOfGravatar';
    load.
((Smalltalk at: #ConfigurationOfGravatar) project stableVersion) load.

Use in your own application

Retrieving the image URL

Usually you display a Gravatar image within a web application. If you generate the HTML you will add an URL for the image. To get one you can use:

Gravatar imageURLFor: 'example@mail.com'

If you require a different size just evaluate:

Gravatar imageURLFor: 'example@mail.com' size: 32.

Retrieving and displaying an image

If you need the real image you can use Pharos Zinc components suite to get the image form over HTTP and open it on your Pharo desk:

|form|
form := ZnEasy getJpeg: (self imageURLFor: 'example@mail.com').
form asMorph openInWorld

Internals

Gravatar is based on MD5 hashing an email address. To get the hashing just evaluate:

Gravatar hash: 'example@mail.com'

Packages

  • Gravatar-Core - package with the core, contains anything you need in an own app
  • Gravatar-Tests - package with the SUnit tests

Testing

The package comes with unit tests tests in the package Gravatar-Tests. Just use the SUnit TestRunner to run them.