A simple .Net standard library to easily get profile picture URL, QR code image URL for profile and profile information for a user using email address from Gravatar.
- Available on Nuget: https://www.nuget.org/packages/GravatarHelper.NetStandard
- To use this library in Xamarin.Forms application, install the GravatarHelper.NetStandard nuget package in portable class library and PCLCrypto package in each client project (e.g Android, iOS and UWP).
- .NetFramework 3.5
- .NetFramework 4
- .NetFramework 4.5
- .NetFramework 4.5.1
- .NetFramework 4.5.2
- .NetFramework 4.6
- .NetFramework 4.6.1
- .NetFramework 4.6.2
- .NetStandard 1.3
- Portable Class Library (.NETFramework 4.5, Windows 8.0, WindowsPhone 8.0, WindowsPhoneApp 8.1)- Profile 259
To get gravatar image URL for email address "[email protected]", use the following syntax.
Gravatar.GetGravatarImageUrl("[email protected]");
To get image URL over https, use following syntax
Gravatar.GetSecureGravatarImageUrl("[email protected]");
There are different overload methods available where you can specify different parameters like image size, required extension for an image, rating, gravatar default image type etc.
To get the QR code image URL for email address "[email protected]", use the following syntax.
Gravatar.GetGravatarProfileQrCodeImage("[email protected]");
To get the gravatar profile information for a user using email address "[email protected]", use the following syntax.
// Available only for .Net Framework 4.5 and above
await Gravatar.GetGravatarProfileInformationAsync("[email protected]");
// For .Net Framework 3.5 and 4.0
Gravatar.GetGravatarProfileInformation("[email protected]");
Above method will return an object of type OperationResult
.
public class OperationResult
{
public bool Success { get; set; }
public ProfileInformation Profile { get; set; }
public string Error { get; set; }
}
If request for profile information is successful, then Success
property will be set to true and Profile
object will contain the profile information.
If request for profile information failed, then Success
property will be set to false, Profile
object will be null
and Error
property will contain the error message.
Note: Profile requests will only resolve for the primary email address