How to display Base64 images in HTML with c#

If you need convert image to Data  URL (embedding Image) here the code:

Encode to Base64 format

  public static string GetDataURL(string imgFile)
        {
            return "<img src=\"data:image/" 
                        + Path.GetExtension(imgFile).Replace(".","")
                        + ";base64," 
                        + Convert.ToBase64String(File.ReadAllBytes(imgFile)) + "\" />";
        }

Commentaires

Posts les plus consultés de ce blog

Caractéristiques de PROLAB LIS SILVER (logiciel de gestion de laboratoire d'analyses médicales)

Solution GED sur le Cloud (Gestion électronique des documents)

How Slack's Custom Mobile App Development Solved the £8.2 Billion Productivity Problem