init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
21
KretaWeb/Helpers/ImageExtensions.cs
Normal file
21
KretaWeb/Helpers/ImageExtensions.cs
Normal 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());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue