Last updated by domix 8 years ago

Avatar Plugin

This plugin provides a taglib for displaying avatars.

At the moment we only support gravatars (globally-recognized avatars).

Gravatars allow users to configure an avatar to go with their email address at a central location: Gravatar-aware websites can then look up and display each user‘s preferred avatar, without having to handle avatar management. The user gets the benefit of not having to set up an avatar for each site that they post on.


  • Domingo Suarez Torres
  • Dmitriy Kopylenko


Plugin code is located at GitHub


'grails install-plugin avatar'


The plugin usage is quite simple.


<avatar:gravatar email="${}"/>

The tagLib will generate the following HTML code:

<img alt="Gravatar" class="avatar" height="20" src="" width="20" />

As you can see, the taglib will generate some html default attributes like:

  • heigth & width
  • CSS class
  • alt
You can customize this default values as follows:
<avatar:gravatar email="${}" alt="My Avatar" cssClass="myCss" size="50"/>


<img alt="My Avatar" class="myCss" height="50" src="" width="50" />

Alternatively you can customize default avatar to users who don't have a Gravatar Account:

<avatar:gravatar email="${}" defaultGravatarUrl="${''.encodeAsURL()}" />

Also can be set the Gravatar rating:

<avatar:gravatar email="${}" gravatarRating="G" />


To avoid expensive configuration each time plugin usage, you can configure global settings as follows:

In Config.groovy

avatarPlugin {