EE Gravatar
The EE Gravatar Plugin allows you to easily insert a "globally recognized avatar" image from Gravatar (http://www.gravatar.com/).
This plugin requires at a bare minimum one of two possible parameters depending on where you wish to use it. The first option is a user's email address "{email}" and the second option is a user's screen name "{name}". The reason for this is so the plugin can be used in situations where one or the other parameter won't return the proper result. It is recommended that you use {email} for comment and entry loops and {name} for display in member profile templates, but feel free to experiment.
Installation
- EE 2: Add the folder /ee_gravatar/ to your ./system/expressionengine/third_party/ folder.
- EE 1.6: Add the file pi.gravatar.php to your ./system/plugins/ folder.
Tags
- {exp:gravatar}
- EE Gravatar only has one tag. This tag must be used with a combination of the parameters below.
Parameters
- email=""
- This parameter should be used for comment and entry loops. You can not use this parameter in combination with the name="" parameter.
- name=""
- This parameter should be used for member profile templates. You can not use this parameter in combination with the email="" parameter.
- default=" "
- Defines a default avatar if there isn't one associated with the email address or if it exceeds the rating.
- rating=""
- Allows you to limit gravatars to the appropriate rating. Anything exceeding the rating will use the default (if supplied) or not display. Value of this parameter should be one of the following 'G', 'PG', 'R', or 'X'.
- size="[1..80]"
- Allows you to define how big the gravatar will be in pixels. Any size other than 80 will cause the original gravatar image to be downsampled using bicubic resampling before output.
Examples
For use in comment or entry loops.
<img src="{exp:gravatar email="{email}"}" />
For use in templates such as Member Profiles where {email} won't work as expected.
<img src="{exp:gravatar name="{name}"}" />
Only displays gravatars of PG rating or lower.
<img src="{exp:gravatar email="{email}" rating="PG"}" />
Displays 40x40 pixel gravatars of R rating or lower.
<img src="{exp:gravatar email="{email}" rating="R" size='40'}" />
Displays gravatars of 70x70 pixels or a default graphic for users without a gravatar. Puts the user's name in the alt and title tags and styles the image using a class called "avatar."
<img src="{exp:gravatar email="{email}" size="70"
default="http://www.somesite.com/someimage.jpg"}"
alt="Picture of {name}" title="{name}" class="avatar" />
This snippet of code from a Public Member Profile template showing how to insert a gravatar into the member listings for your site.
<div class='profileTitle'><img src="{exp:gravatar name="{name}"
size="80" rating="R"}" style="float: left; margin: 0;
padding: 6px;" alt="{name} pic" title="{name}" />{name}</div>
<p>{lang:member_group} <b>5</b></p>
Credit
Current Developer: Philip Zaengle http://www.philipzaengle.com
Original Developer: Les Jenkins of http://stupidevilbastard.com/