Page 1 of 1

Favatar usage

Posted: Thu Aug 17, 2006 7:38 pm
by sillisquid
I tried searching for my question, but couldn't find it.

My blog has a handful of consistent readers, and they often leave comments. I wanted to embed avatars in their comments. Some of them aren't very computer saavy, so I don't mind editing their comments after they have posted them, and adding in whatever code is necessary to make this work.

I installed Gravatar/Favatar because it sounds like it will let me do this. However, I'm not sure how to use this plug-in. Can someone help me out with this?

For instance. If my friend left a comment on my blog. What can I do to modify that comment to inclue an avatar that I specify (and store on my site)?

Thanks!
Sillisquid

Re: Favatar usage

Posted: Fri Aug 18, 2006 1:01 pm
by garvinhicking
Hi!

The gravatar plugin works based on email addresses. Your users need to submit their email address to your comments, and they need to register a picture on the gravatar.com site.

Then based on their email, their icon is displayed on your site.

A favator works a bit differently; it uses the "homepage url" adress of your users and checks if a "favicon.ico" is present, and then shows that one.

HTH,
Garvin

Posted: Fri Aug 18, 2006 7:02 pm
by jerwarren
Do the commenters always put in the same name/email, etc? Or do you just know who they are?

If they do use email addresses, it wouldn't be too tough to automate this behavior, you'd just have to make and upload the proper images for each person.

Are they consistent in doing this?

Posted: Fri Aug 18, 2006 8:00 pm
by garvinhicking
Hi!
jerwarren wrote:Do the commenters always put in the same name/email, etc? Or do you just know who they are?
Of course you cannot force your commenters to enter their email/URL. Only if they do you can associate gravatars/favatars to them.
If they do use email addresses, it wouldn't be too tough to automate this behavior, you'd just have to make and upload the proper images for each person.
Uhm, gravatars are fetched off-site. No images are stored on your server. You might want to read the FAQ on www.gravatar.com :-)

Best regards,
Garvin

Posted: Sat Aug 19, 2006 12:30 am
by jerwarren
I'm not used to this forum stuff.. I was intending to ask the person who originally posted the question. I was going to help him rig it so that it works the way he wants, assuming his readers are already behaving in consistent ways.

I was just going to edit the template to load an image like for instance, "/avatars/$EMAIL_ADDRESS.png" (except using the actual variable name, which I haven't looked up yet ) where he would manually save whatever images he wanted to associate with each address/name.

If they aren't behaving in consistent ways, then I'd have to think about it some more.

Posted: Mon Aug 21, 2006 1:31 pm
by garvinhicking
Hi!

Ah! Uck! Argh. My mistake. I fully understand you. I just didn't pay attention enough to look up the poster name properly. Sorry for that confusion!

Best regards,
Garvin

Posted: Thu Aug 24, 2006 3:06 am
by sillisquid
Thanks for the replies, folks. Sorry, I've been away from the computer for a few days....
Do the commenters always put in the same name/email, etc? Or do you just know who they are?

If they do use email addresses, it wouldn't be too tough to automate this behavior, you'd just have to make and upload the proper images for each person.

Are they consistent in doing this?
Yes, they are pretty consistent with this information. I figure if they put something different, I could modify the comment, and "fix" it for them.

You seem to know exactly what I'm trying to do, so any help/suggestions/advice is greatly appreciated! Thanks!!

Posted: Fri Aug 25, 2006 8:29 pm
by jerwarren
You seem to know exactly what I'm trying to do, so any help/suggestions/advice is greatly appreciated! Thanks!!
OK, I just whipped up something that will do what you want. It doesn't currently take actual gravatar images into account however, so if you use my system and a user does actually have a gravatar image, you'll get both.

What you need to do is:

1) add the following to your 'comments.tpl' file. (which most likely is currently residing in serendipity/templates/default/) If your template is using a modified one, it will be in that template's directory.

Code: Select all

{if $comment.email}
        <img src="{$serendipityBaseURL}/avatars/{$comment.email}" align="left">
    {/if}
Put that right before the DIV with the class of "serendipity_commentBody".

2) create a directory named "avatars" in the root of your serendipity installation, and put any avatar images that you want to associate with users in it. Name the files like this:

Code: Select all

jer[at]nyquil.org
test[at]test.org
billg[at]microsoft.com
It doesn't matter what image format you use, just make sure the filename looks just like that. In my example, the file named "jer[at]nyquil.org" is actually a png, it just isn't named like one.

3) create a default avatar to display if someone doesn't have one on your system, and name it as "default_avatar.png" in your newly created "avatars" directory. If you don't want a generic image, and would prefer to just not display an avatar, make this default avatar image a 1x1 pixel transparent gif/png or something. Feel free to steal my default one if you'd like.

4) create a file named ".htaccess" in your "avatars" folder, and put the following line in it:

Code: Select all

ErrorDocument 404 /avatars/default_avatar.png
What that's doing is covering up for the fact that someone might put in an email address that you haven't made an avatar for, which might cause some browsers to display a broken image in place of an avatar image. The .htaccess rule says that instead of a "file not found", the browser be send your blank avatar image instead.

If you want to see what this looks like in action, check out http://comics.nyquil.org/archives/4-Par ... l#comments .

The little questionmarky ones on the left are the default avatar image, and the ones on the right are gravatars. I just posted the "(this is a test)" comment so you can see a local avatar along with the default avatars.

In the long-term this could probably be incorporated into the actual gravatar plugin so that there isn't a conflict between gravatars and your handmade local avatars, but I don't really feel like going to that effort just now :)

Let me know if you have any troubles with anything, I'll gladly help you figure it out.

Posted: Fri Aug 25, 2006 8:34 pm
by sillisquid
I visited your link, and that's exactly what I'm trying to do. I can't wait to get home from work tonight and try out your suggestions.

Thanks for your prompt and comprehensive response. I'll let you know if I have problems, or if I can claim success. :)