Skip to content

Commit

Permalink
Added a parameter called "Size" to the "RadzenGravatar" component. (#…
Browse files Browse the repository at this point in the history
…1932)

* Added a parameter called "Size" to the "RadzenGravatar" component. This will allow for users to adjust the size of the gravatar image coming in, so that they are not stuck with just a 32px image.

* Corrected the default value from 32 to 36, and remove the width variable in favor of the parametised Size variable. (As per suggestion from akorchev - thanks)

* Corrected a typo where the "value" attribute was inside the summary, it is now outside, where it should be.
  • Loading branch information
jamesalainheffer authored Jan 31, 2025
1 parent df0ad0d commit ff846e0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Radzen.Blazor/RadzenGravatar.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ public partial class RadzenGravatar : RadzenComponent
[Parameter]
public string AlternateText { get; set; } = "gravatar";

/// <summary>
/// Gets or sets the size. Defaulted to 36 (pixels).
/// </summary>
/// <value>The size of the image in pixels.</value>
[Parameter]
public int Size { get; set; } = 36;

/// <summary>
/// Gets gravatar URL.
/// </summary>
Expand All @@ -38,9 +45,8 @@ protected string Url
var md5Email = MD5.Calculate(System.Text.Encoding.ASCII.GetBytes(Email != null ? Email : ""));

var style = "retro";
var width = "36";

return $"https://secure.gravatar.com/avatar/{md5Email}?d={style}&s={width}";
return $"https://secure.gravatar.com/avatar/{md5Email}?d={style}&s={Size}";
}
}

Expand Down

0 comments on commit ff846e0

Please sign in to comment.