Gravatar support

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Gravatar support

Jim Westergren
Gravatar has now become widely used. Not only by WordPress but for example by the Disqus comment system and many big websites such as stackoverflow.com.

I would like to have it enabled in Nabble and it is actually really easy to implement.

The coding could go like:

If (user don't have any avatar uploaded to nabble) {
$emailhash = md5( strtolower( trim( "MyEmailAddress@example.com " ) ) );
$img_src = "http://www.gravatar.com/avatar/".$emailhash."?s=100&r=pg&d=".urlencode("http://n2.nabble.com/images/avatar100.png").";
}

Notice that images are retained at 100px x 100px and that the same default image is shown if the user has no gravatar.
Owner of the free website service N.nu
Reply | Threaded
Open this post in threaded view
|

Re: Gravatar support

Hugo <Nabble>
The problem of this approach is that we have to expose the email of our users in the source of the HTML page. Malicious bots could collect those emails and use them in a bad way (e.g., send spam), which is horrible. Do you know if there are other options?
Reply | Threaded
Open this post in threaded view
|

Re: Gravatar support

Jim Westergren
The email is not exposed of course. Just the hash so there is no worry of that. The code I gave is PHP which is not visible in HTML. I don't know what language Nabble is written in but the code should be similar.

The HTML would be something like:

<img class="avatar light-border-color" src="http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=100&r=pg&d&d=http%3A%2F%2Fn2.nabble.com%2Fimages%2Favatar100.png" alt="Jim Westergren" title="Jim Westergren" width="100" height="100">
Owner of the free website service N.nu
Reply | Threaded
Open this post in threaded view
|

Re: Gravatar support

Jim Westergren
In reply to this post by Hugo <Nabble>
Is Nabble written in Java? See here: http://www.gravatar.com/site/implement/images/java/
Owner of the free website service N.nu
Reply | Threaded
Open this post in threaded view
|

Re: Gravatar support

Hugo <Nabble>
We are discussing this internally. Thanks for the suggestion and sample code.
Reply | Threaded
Open this post in threaded view
|

Re: Gravatar support

Hugo <Nabble>
Hi Jim, this will be available after the next release. Thanks for the suggestion.
Reply | Threaded
Open this post in threaded view
|

Re: Gravatar support

Jim Westergren
Thank you Hugo. A good decision.
Owner of the free website service N.nu