How to give src to the

前端 未结 8 1585
抹茶落季
抹茶落季 2020-12-09 21:11

I want to display an image on a web page using HTML tag.

I have stored the image on my local drive.

How to achieve this?

Th

8条回答
  •  一生所求
    2020-12-09 21:40

    You can look into my answer . I have resolved the issue using C# language Why can't I do ?

    
                            if (File.Exists(filepath)
                            {
                                byte[] imageArray = System.IO.File.ReadAllBytes(filepath);
                                string base64ImageRepresentation = Convert.ToBase64String(imageArray);
                                var val = $"data: image/png; base64,{base64ImageRepresentation}";
                                imgEvid.Attributes.Add("src", val);
                            }
    

    Hope this will help

提交回复
热议问题