How to display base64 encoded image in HTML if it is located in a separated file?

后端 未结 4 960
悲哀的现实
悲哀的现实 2020-12-14 12:02

I have base64 encoded image. If I put it right into html it works:


But when I put all that b

4条回答
  •  囚心锁ツ
    2020-12-14 12:46

    You would need to send the correct Content-type, Content-encoding and charset HTTP headers along with the file. Note that they are all part of the data: URI schema as well. You really should have a charset=utf-8 or similar clause between the content-type and the encoding:

    url(data:image/png;charset=utf-8;base64,...);
    

提交回复
热议问题