This commit is contained in:
skidoodle 2024-03-13 00:33:46 +01:00
commit e124a47765
19374 changed files with 9806149 additions and 0 deletions

View file

@ -0,0 +1,21 @@
using System.Web.Mvc;
namespace Kreta.Web.Helpers
{
public static class ImageExtensions
{
public static MvcHtmlString Base64EncodedImage(this HtmlHelper htmlHelper, string encodedImage, string alText = default(string))
{
var tagBuilder = new TagBuilder("img");
tagBuilder.Attributes.Add("class", $"rounded mx-auto d-block");
tagBuilder.Attributes.Add("src", $"{encodedImage}");
if (!string.IsNullOrWhiteSpace(alText))
{
tagBuilder.Attributes.Add("alt", alText);
}
return new MvcHtmlString(tagBuilder.ToString());
}
}
}