Parameters

email=

All Gravatar images are based on the use of an email address. Specifying the email address will allow you to request an image for that email.

<img src="{exp:ce_gravatar:single email='software@causingeffect.com'}" alt="" />

Note: If no email address is provided, the default Gravatar (below) will be used:

<img src="{exp:ce_gravatar:single email=''}" alt="" />

size=

The dimension in pixels, that you would like to be used for the Gravatar image width and height (all Gravatar images are square. The value should be a whole number greater than 0 and less than or equal to 512. If not specified, the default size is 80px.

Note: Many user-uploaded Gravatar images are low resolution, so requesting large images may result in pixelated and/or low-quality images.

<img src="{exp:ce_gravatar:single email='software@causingeffect.com' size='250'}" alt="" />
<img src="{exp:ce_gravatar:single email='software@causingeffect.com' size='100'}" alt="" />
<img src="{exp:ce_gravatar:single email='software@causingeffect.com' size='10'}" alt="" />
<img src="{exp:ce_gravatar:single email='software@causingeffect.com' size='1'}" alt="" />

default=

The behavior to fallback to if a Gravatar cannot be found for the provided email address hash. This parameter can be a URL to an image you would like to use or any of the following:

  • 404: will return `` (an empty string) if the user does not have an image. If using the tag pair syntax, this also gives you the ability to check if a Gravatar exists by using the {if gravatar}{/if} conditional.
  • mm: mystery-man (does not vary by email hash)
  • identicon: a geometric pattern based on an email hash
  • monsterid: a generated "monster" with different colors, faces, etc
  • wavatar: generated faces with differing features and backgrounds
  • retro: 8-bit arcade-style pixelated faces

The following are examples of the different default types:

Here is the code used to create the above example images:

<!-- custom URL -->
<img src="{exp:ce_gravatar:single email='blah@example.com' default='http://www.causingeffect.com/images/example/unique_80_80_cy_100_sha-20.jpg'}" alt="" />

<!-- 404 -->
{exp:ce_gravatar:pair email="blah@example.com" default="404"}
{if gravatar}
{!-- a Gravatar image exists for the provided email address --}
<img src="{gravatar}" alt="" />
{if:else}
{!-- no Gravatar, so let's create our own default image --}
{exp:ce_img:single src="/images/example/cow_square.jpg" max="80"}
{/if}
{/exp:ce_gravatar:pair}

<!-- mm -->
<img src="{exp:ce_gravatar:single email='blah@example.com' default='mm'}" alt="" />

<!-- identicon -->
<img src="{exp:ce_gravatar:single email='blah@example.com' default='identicon'}" alt="" />

<!-- monsterid -->
<img src="{exp:ce_gravatar:single email='blah@example.com' default='monsterid'}" alt="" />

<!-- wavatar -->
<img src="{exp:ce_gravatar:single email='blah@example.com' default='wavatar'}" alt="" />

<!-- retro -->
<img src="{exp:ce_gravatar:single email='blah@example.com' default='retro'}" alt="" />

Note: Note that the email address specified in the examples above is fake and does not have a Gravatar associated with it.

Note: If you use a custom URL for the default, make sure it is pre-sized to your desired dimensions, as the Gravatar service no longer resizes the image for you.

force_default=

You may want to force the default image to be used. For example, if you have your default parameter set to default="monsterid", and you always want a monster to be generated for each email address, if they have a Gravatar image or not, you would enable this parameter. Otherwise, the monsterid would only show up for email addresses that do not have an associated Gravatar image.

<!-- This email address has a Gravatar -->
<img src="{exp:ce_gravatar:single email='software@causingeffect.com' default='monsterid'}" alt="" />

<!-- This email does not have a Gravatar -->
<img src="{exp:ce_gravatar:single email='blah@example.com' default='monsterid'}" alt="" />

<!-- This email address has a Gravatar, but the default is forced -->
<img src="{exp:ce_gravatar:single email='software@causingeffect.com' default='monsterid' force_default='yes'}" alt="" />

rating=

The Gravatar site explains ratings in the following way:

Gravatar allows users to self-rate their images so that they can indicate if an image is appropriate for a certain audience. By default, only 'G' rated images are displayed unless you indicate that you would like to see higher ratings.

This parameter can be set to any of the following values:

  • g: suitable for display on all websites with any audience type
  • pg: may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence
  • r: may contain such things as harsh profanity, intense violence, nudity, or hard drug use
  • x: may contain hardcore sexual imagery or extremely disturbing violence
<img src="{exp:ce_gravatar:single email='software@causingeffect.com' rating='pg'}" alt="" />

use_https=

If the page on which you are displaying Gravatar images is being served over SSL, then you will want to enable this parameter.

<!-- Normal -->
<img src="{exp:ce_gravatar:single email='software@causingeffect.com'}" alt="" />

<!-- Secure -->
<img src="{exp:ce_gravatar:single email='software@causingeffect.com' use_https='yes'}" alt="" />

The above template code results in the following HTML:

<!-- Normal -->
<img src="http://www.gravatar.com/avatar/b0c88c73641f047acf1c7bf1f88f5d07" alt="" />

<!-- Secure-->
<img src="https://secure.gravatar.com/avatar/b0c88c73641f047acf1c7bf1f88f5d07" alt="" />

add_extension=

If you would like your Gravatar to have a file-type extension, you can enable this parameter. A .jpg extension will be appended to your URL.

<!-- Normal -->
<img src="{exp:ce_gravatar:single email='software@causingeffect.com'}" alt="" />

<!-- With extension -->
<img src="{exp:ce_gravatar:single email='software@causingeffect.com' add_extension='yes'}" alt="" />

The above template code results in the following HTML:

<!-- Normal -->
<img src="http://www.gravatar.com/avatar/b0c88c73641f047acf1c7bf1f88f5d07" alt="" />

<!-- With extension -->
<img src="http://www.gravatar.com/avatar/b0c88c73641f047acf1c7bf1f88f5d07.jpg" alt="" />