IdenticonTagHelper Class

Tag helper used to display an identicon in <img> elements.
public class IdenticonTagHelper : TagHelper
View source
Namespace
Jdenticon.AspNetCore
Assembly
Jdenticon.AspNetCore.dll
Inheritance
SystemObject TagHelper Jdenticon.AspNetCoreIdenticonTagHelper

Remarks

The following attributes are available for this tag helper.

Attribute nameDescription
identicon-valueValue that will be hashed using SHA1 and then used as base for this icon.
identicon-hashHash that will be used as base for this icon.
identicon-formatFormat of the generated icon. This attribute is optional and defaults to PNG.
widthThe width of the generated icon.
heightThe height of the generated icon.

The size of the icon is determined from the specified width and height of the <img> tag.

Note Note
Only square icons are supported. Specifying different width and height will end up in a distorted icon.

Examples

In the following example identicon-value is used to render an identicon for a user id.

Using identicon-value
@{
    var userId = "TestIcon";
}
<img identicon-value="userId" width="100" height="100" /&lt;

Constructors

Public methodIdenticonTagHelper
Initializes a new instance of the IdenticonTagHelper class

Properties

Public propertyCode exampleFormat
Gets or sets the format of the generated icon. This attribute is optional and defaults to PNG.
Public propertyCode exampleHash
Gets or sets a hash that will be used as base for this icon.
Public propertyCode exampleValue
Gets or sets the value that will be hashed using SHA1 and then used as base for this icon.

See Also

Reference