Class GravatarIconSource
- Namespace
- Tharga.Team
- Assembly
- Tharga.Team.dll
Built-in IIconSource that resolves a user subject with an email to its Gravatar image, when enabled via IconSettings. Registered after StoredIconSource and any consumer sources, so an explicitly uploaded user icon (and custom sources) take precedence and Gravatar is a fallback. Returns null for team subjects, users without an email, or when disabled.
public sealed class GravatarIconSource : IIconSource
- Inheritance
-
GravatarIconSource
- Implements
- Inherited Members
Constructors
GravatarIconSource(IconSettings)
public GravatarIconSource(IconSettings settings = null)
Parameters
settingsIconSettings
Methods
AvatarUrl(string, string)
The Gravatar URL for email at style.
public static string AvatarUrl(string email, string style)
Parameters
Returns
- string
An absolute URL, or null when
emailis missing.
PreviewUrl(string, string)
The URL that previews what style looks like, rather than what
email looks like.
public static string PreviewUrl(string email, string style)
Parameters
Returns
- string
An absolute URL, or null when
emailis missing.
Remarks
f=y is what makes this a preview of the style. Gravatar serves the account's own photo
whenever the email has one, whatever d asks for — so without forcing the default, every style
previews identically for anybody who has a Gravatar, and a style picker reads as broken.
ResolveAsync(IconSubject, CancellationToken)
Resolve an image for subject, or null to defer to the next source.
public Task<IconImage> ResolveAsync(IconSubject subject, CancellationToken cancellationToken = default)
Parameters
subjectIconSubjectcancellationTokenCancellationToken