Whilst the Gravatar service’s API (well, it’s really just a URL) is pretty straightforward, is there a simple helper method out there that does a good job of reflecting all the options available for Gravatar?
- Image size
- Default image (when user hasn’t specified one)
- Rating (G/PG/R/X)
Ideally this would be an HtmlHelper extension method.
I’m targetting MVC2 on .NET4, but I suppose others would be interested in options for earlier versions too.
EDIT Implementations should allow providing additional attributes for the generated HTML element too.
Thanks for your answers. In the end I wrote my own solution, so I’ll post it here for anyone else who might find it useful.
It caters for all the functionality Gravatar supports right now, as listed in the question.
Use it like this:
I provided optional arguments for any, er, options. These can be combined.
Here’s the code: