hashi hashi - 2 months ago 12x
HTML Question

how to convert Image to Data URI for Html with C#?

I need convert image to Data URL (embedding Image) in the Win-application for HTML and I need
Data URL (embedding Image) to image.

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