Announcing EEGravatar.

Posted by Les on Tuesday, July 27, 2004 at 10:35 PM. Read 14010 times. Tags: ,
{name} pic

I’ve written my first plugin in PHP for ExpressionEngine called EEGravatar. It’s basically a simple way of allowing for avatars in your entries or comments using a centralized avatar hosting service called, oddly enough, Gravatar. If you’d like an avatar image of your own for the comments, just go to the Gravatar site and register using the same email address you use to post comments here and upload an avatar no bigger than 80x80 pixels. Once it’s approved it’ll start showing up in your comments automatically.

If you’d like to use EEGravatar on your own ExpressionEngine blog you can download a copy by clicking here. There is also a plugin available for MovableType and WordPress. There’s also a hack for TextPattern.

Update: I’ve duplicated the docs included in the plugin in the extended entry.

Updated Update: Here’s a little Gravatar button I made if you want to use it:

Version Update: The plugin has been updated to EE Gravatar 1.2 for use with ExpressionEngine 1.1 and is now a single tag plugin. See the updated docs in the plugin or down below for examples.

Version Update: The plugin has been updated to EE Gravatar 1.3 (the Lisa-Jill version). Minor change to output for XHTML compliance.

Version Update 10/2/04: EEGavatar is now up to version 1.4. Can now use {name} in addition to email as the one required parameter for use in Member Profiles and other places where the email parameter breaks the plugin. See documentation below for more information.

Documentation

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 and the second option is a user’s screen 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. Here’s the two minimum required uses:

<img src="{exp:gravatar email="{email}"}" /> -- For use in comment or entry loops.

<
img src="{exp:gravatar name="{name}"}" /> -- For use in templates such as Member Profiles where email won't work as expected.

== OPTIONAL PARAMETERS ==

default="http://www.somesite.com/someimage.jpg"

Defines a default avatar if there isn’t one associated with the email address or if it exceeds the rating.

rating="[G | PG | R | X]”

Allows you to limit gravatars to the appropriate rating. Anything exceeding the rating will use the default (if supplied) or not display.

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

border="[hex color]”

Puts a border of the specified color around the gravatar.

== POSSIBLE EXAMPLES ==

Here’s a few examples that you might use:

<img src="{exp:gravatar email="{email}" rating="PG"}" />

Only displays gravatars of PG rating or lower.

<img src="{exp:gravatar email="{email}" rating="R" size="40" border="FF0000"}" />

Displays 40x40 pixel gravatars of R rating or lower with a red border around them.

<img src="{exp:gravatar email="{email}" size="70" default="http://www.somesite.com/someimage.jpg"}" alt="Picture of {name}" title="{name}" class="avatar" />

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.”

<div class='profileTitle'><img src="{exp:gravatar name="{name}" size="80" rating="R"}" border="0" style="float: left; margin: 0; padding: 6px;" alt="{name} pic" title="{name}" />{name}</div>
<
p>{lang:member_group}&nbsp; <b>{member_group}</b></p>

The above is a snippet of code from my Public Member Profile template showing how to insert a gravatar into the member listings for your site.

== Change Log ==

V1.4 - Added {name} parameter as alternate to {email} for use in situations where {email} breaks the plugin such as Member Profiles.

V1.3 - Changed & to & for XHTML validation compliance.

v1.2 - Made {email} into a parameter along for single tag usage for EE 1.1 release.

v1.1 - Minor bug fix.

v1.0 - Initial Release

Comments:

Page 1 of 4 pages  1 2 3 >  Last »

John Hoke United States Posted on 07/28/2004 at 12:13 AM

John Hoke pic

Les,
Congrats! I have to upload my avatar, and then get the MT plugin workin’ over at the Asylum

Not bad for a few hours work tho’ huh?

Brooks United States Posted on 07/28/2004 at 01:08 AM

Brooks pic

Cool. I’ve uploaded mine and I’m waiting for it to be OK’d. It bothers me a bit that they need to be OK’d though. Where do they draw the line?

 Signature 

Brooks Ayola
http://blog.ayola.com
http://prophotofporums.com

Lisa United States Posted on 07/28/2004 at 02:38 AM

Lisa pic

It’s not an approval I believe, but rather a rating.  That way people who have g-rated sites can restrict the gravatars to only showing grated ones.  Makes it more globally ‘safe’. =)

Les United States Posted on 07/28/2004 at 06:32 AM

Les pic

Lisa’s right. They don’t seem to draw a line as to what you can use, but they do apply a rating to it. I can see where that might still cause some disputes, but they make it clear they hold final say on all ratings.

Now I need to fix the layout of SEB so that the containing boxes for the comments expands properly to hold the floating icon. There’s a simple fix that works great in Mozilla, but causes IE to spaz out. I need to rip the site apart and rebuild it anyway I suppose.

 Signature 

Gods dont kill people. People with Gods kill people. - David Viaene

Sue United States Posted on 07/28/2004 at 07:14 AM

Sue pic

Looks interesting, I uploaded mine too. smile Sounds like a great plugin.

Queen Millefiori United States Posted on 07/28/2004 at 07:35 AM

Queen Millefiori pic

I like this. Mine’s uploaded and waiting for my “G” rating.

John Hoke United States Posted on 07/28/2004 at 07:40 AM

John Hoke pic

Ya know days like this I hate MT

I started installing it into Movable Type, but with it’s convert linebreaks functionality, things get all wonky wink

Glad to see you got it running in EE w/out a problem!

-j

Les United States Posted on 07/28/2004 at 08:14 AM

Les pic

Hmmm. Not sure why that would be a problem. EE does the convert line break as well as convert to XHTML and it doesn’t pose a problem.

 Signature 

Gods dont kill people. People with Gods kill people. - David Viaene

John Hoke United States Posted on 07/28/2004 at 08:44 AM

John Hoke pic

Take a look at this
http://john.hoke.org/archive/2004/07/the_geek_in_me.php#c1186

This is Tom’s comment with his gravatar, see how by ‘converting line breaks’ in MT, even when wrapped in a div… I never liked MT’s convert line breaks and I tend to avoid using them in my posts except when I am lazy, but they are essential for comments… I dont want people entering HTML smile

***Dave United States Posted on 07/28/2004 at 09:05 AM

***Dave pic

Coolness.  I’ve uploaded one, and will consider the functionality on my own blog.

Les United States Posted on 07/28/2004 at 09:08 AM

Les pic

Wow, that is interesting. I wouldn’t have thought it would have applied it outside of the confines of the $MTCommentBody$ tag. You’d think if it were applying it to everythign between the MTComment loop it would screw up your layout even more.

 Signature 

Gods dont kill people. People with Gods kill people. - David Viaene

Les United States Posted on 07/28/2004 at 09:40 AM

Les pic

Well, I’ve moved the gravatars to the right of the comment, put in a min-height for the comment div to ensure it’s big enough to hold the image without overlap, and modified them so they’re clickable providing a link back to the blog of the commenter in question.

Given enough time to bang my head against the wall, I eventually knock some sense into it.

 Signature 

Gods dont kill people. People with Gods kill people. - David Viaene

OB United States Posted on 07/28/2004 at 09:44 AM

OB pic

What a great feature!  Good job, Les!  Mine’s in for approval.  cheese

("why" - cuz I felt like it!)

 Signature 

Invisible friends are for children and psychopaths.

Dave M. United States Posted on 07/28/2004 at 11:18 AM

Dave M. pic

Cool! I can’t wait to see mine in! I have been wanting to do this for a while. Just haven’t found a good way of doing it yet. I guess I have now. smile

 Signature 

Dave Metzener
Dave’s Chalkboard

Brooks United States Posted on 07/28/2004 at 11:20 AM

Brooks pic

Lisa’s avatar is scaring me a bit. OK, I understand the rating thing better now. I stand corrected. I have no problem with a rating system, it’s actually a great idea. I guess until you figure out the part about expanding the box to fit the avatar, I’ll just have to write more so you don’t notice it.

captcha = child Ain’t that the truth.

 Signature 

Brooks Ayola
http://blog.ayola.com
http://prophotofporums.com

Dave M. United States Posted on 07/28/2004 at 11:37 AM

Dave M. pic

OK, I give… What do I need to do to get my rated avatar to show up? How does the site know which avatar to put on which comment?

 Signature 

Dave Metzener
Dave’s Chalkboard

Sue United States Posted on 07/28/2004 at 11:40 AM

Sue pic

Dave M. - did you get mail back from Gavatar.com yet? Until you do, you won’t see your avatar on Les’ site. Mine just got approved. It’s not automatic at all. Mine is “G” rated.

Sue United States Posted on 07/28/2004 at 11:42 AM

Sue pic

Dave M. - your avatar is stored based on your email address. So make sure your email address is the same on the sites that use GAvatar. I made mine for my gmail address, but I have about 3 more addresses I post with, depending on the site.

Dave M. United States Posted on 07/28/2004 at 11:52 AM

Dave M. pic

Sue: Yea, I got my rating back. I even changed my e-mail address to match the address I used with GRavatar. They still are not showing up. I thought I had before, but I forgot about needing to put the password in. Now it is the same, yet I’m still not seeing it. Unless when I post this comment it will show up.

I’m not all that sure I like the idea of using my e-mail address for the link to my avatar. I use different addresses all over the place. One for each site I comment on. That would be quite a few GRavatar’s plus I would be giving GRavatar the addresses I use to determine if I am getting spam from that site. I wouldn’t know if the site is spilling my e-mail address or GRavatar.

They should use and ID number that can be saved on the site like avatars can now.

I think I’ll stick with having the user send a link to the avatar they want to use and display that instead.

Shame really. This had some good potential…

 Signature 

Dave Metzener
Dave’s Chalkboard

Spocko United States Posted on 07/28/2004 at 12:05 PM

Spocko pic

Far out - let’s see if mine works…

Spocko United States Posted on 07/28/2004 at 12:11 PM

Spocko pic

Rats, didn’t work. I’m already rated.
Les - is the email comparison case-sensitive?

John Hoke United States Posted on 07/28/2004 at 12:30 PM

John Hoke pic

Ya know, I gave up on this for a couple of reasons… one the MT being a bitch about layout issue, and more importantly, as I was going through my MT backend DB… almost no one enters a real email address so whats the point wink

-j-

deadscot United States Posted on 07/28/2004 at 12:40 PM

deadscot pic

Les - Is this going to effect the avatars in the forums as well?

Dave M. - I’m with you.  I think this a neat feature but I’m not really thrilled about having a centralized e-mail address in order to make use of this.  A linked Gravatar ID would be better.

Etan United States Posted on 07/28/2004 at 01:09 PM

Etan pic

Les, mind divulging the CSS you used? I really like your design for the avatar placement.

 Signature 

“An eye for an eye leaves us all blind.” - Gandhi

Chris United States Posted on 07/28/2004 at 01:50 PM

Chris pic

You beat me to it, Les!  Good job with the plugin.  I look forward to seeing other plugins you make.

Page 1 of 4 pages  1 2 3 >  Last »

Name:

Email:

Location:

URL:

Smileys


Remember my personal information

Notify me of follow-up comments?

Submit the word you see below:


<< Back to main

Stupid Evil Bastard