简体   繁体   中英

Does prefix 'data:image/png;base64,' of base64 affect to displaying image?

I am using AngularJS. I display my image as: src="data:image/png;base64,iVBORw0KG..." successfully. When I change 'png' to jpeg, gif or jpg, nothing happened. It still displays correctly. So I want to ask you the prefix affect to displaying image or not? Negative or positive?

Moreover, I receive data image from server without any prefix. So I have to set a hardcode 'data:image/png;base64,'. This is good or bad? Could you pls help me? Thanks so much. :)

在html情况下,当您设置scr = base64String时,如果图像没有前缀,则无法正确显示。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM