NuGet Package | Statistics |
---|---|
GravatarHelper | |
GravatarHelper.Common | |
GravatarHelper.AspNetCore |
A set of libraries providing Gravatar support to .NET and .NET Core .
To install GravatarHelper, run the following command in the Package Manager Console
ASP.NET MVC 3 / 4 / 5:
Install-Package GravatarHelper
ASP.NET Core MVC:
Install-Package GravatarHelper.AspNetCore
and add the following to your _ViewImports.cshtml
file:
@using GravatarHelper.Common
@addTagHelper *, GravatarHelper.AspNetCore
Non-MVC:
Install-Package GravatarHelper.Common
Create a Gravatar img tag for "[email protected]", 80 pixels large with "My Gravatar" as title and "Gravatar" as alt text.
@Html.Gravatar("[email protected]", 80, new { Title = "My Gravatar", Alt = "Gravatar" })
Create a Gravatar link for "[email protected]", 80 pixels large with "Identicon" as the default image.
<a href="@Url.Gravatar("MyEmailAddress@example.com", 80, GravatarHelper.DefaultImageIdenticon)">Your Gravatar</a>
Create a Gravatar Profile link for "[email protected]".
<a href="@Url.GravatarProfile("MyEmailAddress@example.com")">Your Gravatar Profile</a>
<img gravatar-email="[email protected]" gravatar-size="80" alt="My Gravatar" />
The NuGet package should by default add two using statements to the /views/web.config file allowing Gravatar extension methods to be used throughout all view files. If this fails then you can manually add the following two namespaces to the /views/web.config file:
<system.web.webPages.razor>
<pages>
<namespaces>
<add namespace="GravatarHelper.Common" />
<add namespace="GravatarHelper.Extensions" />
</namespaces>
</pages>
</system.web.webPages.razor>
Or alternatively add the namespace directly to the relevant view files:
@using GravatarHelper.Common
@using GravatarHelper.Extensions
GravatarHelper is licensed under the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication