/Gravatar-FluidHtmlHelper

A simple Gravatar Fluid HTML Helper for Razor and Asp.Net MVC

Primary LanguageC#

Gravatar Fluid Html Helper for Razor and ASP.Net MVC

I just decided to update Andrew Freemantle’s version to be fluid. I just think it makes things simplier.

This is a Fluid HTML Helper implementation of the Gravatar image request API, according the Gravatar documentation, building on the fine work done by Andrew Freemantle.

Features

  • Size

  • Default image (404, mystery-man, identicon, monsterid, wavatar, retro)

  • Custom default image (url)

  • Force default image

  • Ratings

  • Secure requests (HTTPS) is automatic (but can be forced)

  • Image Tooltips

Getting Started

  1. Drop the single GravatarHtmlHelper.cs into your ASP.Net MVC project, be sure to adjust the namespace

  2. Start using it in your Views:

    @Html.GravatarImage("user.name@email.com")
    @Html.GravatarImage().EmailAddress("user.name@email.com").Rating(GravatarImage.RatingOptions.R).Size(120)
    @Html.GravatarImage().EmailAddress("user.name@email.com").Rating(GravatarImage.RatingOptions.R).Size(80).Tooltip("Avatars confirmed via Gravatar.com").DefaultImageUrl("http://SomePath.com/to/your/default/image.jpg.jpg").EncodeDefaultImageUrl(true)
    

Well you get the idea. Hope this helps someone else as well. I’ll clean it up more soon.