Simple Gravatar — jcp_simple_gravatar
— is a Textpattern plugin that simplifies the use of Gravatar avatars on your Textpattern site.
How to install Simple Gravatar.
Use <txp:jcp_simple_gravatar />
in your templates. It will return the gravatar URL.
There are four attributes, and all are optional;
email
— custom email address for gravatar (if not specified, the plugin uses the comment author’s email)
user
— get user’s gravatar (input: the user’s username)
default
— default avatar, if no gravatar was found
default_local
— default avatar. A local file, like images/9.png
, that becomes http://yoursite.com/images/9.png
(good for development)
size
— the image size, in pixels (default: 80)
format
— the file format, like .jpg or .png, without the dot (default: jpg)
where
— is the gravatar in an article or in a comment? This is completely optional, Simple Gravatar can pick the right one for you.
In the comments form:
<img src="<txp:jcp_simple_gravatar default="http://thesite.net/images/avatar.jpg" size="50" format="png" />" width="50" height="50" />
May return:
<img src="http://gravatar.com/avatar/4fdce145bab6d27d69e34403f99fd11c.png?s=50&d=http%3A%2F%2Fthesite.net%2Fimages%2Favatar.jpg" width="50" height="50" />
In an article:
Author: <txp:author /><br /> <img src="<txp:jcp_simple_gravatar default_local="/images/6.png" size="60" />" />
May return:
Author: Andrew Dorsey<br /> <img src="http://gravatar.com/avatar/e0a2988a7d97b4def8426cbead7b1a9b.png?s=60&d=http%3A%2F%2Fmysite.com%2Fimages%2F6t.png" width="60" height="60" />
Get user’s avatar:
About Andrew:<br /> <img src="<txp:jcp_simple_gravatar user="andrew" />" />
May return:
About Andrew:<br /> <img src="http://gravatar.com/avatar/e0a2988a7d97b4def8426cbead7b1a9b.png?s=80" />
Simple Gravatar for Textpattern is based on the glx_gravatar plugin by Patrick Kollitsch, and is licensed under the GNU General Public License v2.
Please email me at jocapriconne at gmail.com.