How to use data URI scheme to embed pictures in a web page
This article will explain in detail how to use data URI scheme to embed pictures in the web page. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Data URI scheme allows us to use inline (inline-code) to include data in web pages, which can be used in Html, CSS, Javascript, etc.
Data URI scheme is often used to embed pictures into web pages, using the following:
The data URI scheme format is as follows:
Data: [] [; base64]
This format is relatively simple, and if you compare it, you can see that the img above is a jpg image encoded in base64.
Embed this img into this page and display it as follows:
In addition to base64 encoding, you can also use hexadecimal URL encoding in the form of% xx, as follows:
_ fcksavedurl= "" data:image/jpeg,%FF%D8%FF%E0JFIFq/* omitted a lot of data here * /% F7*q%D6Q%EDt%F6%EE%7F%FF%D9 "/ >" _ fcksavedurl= "" data:image/jpeg,%FF%D8%FF%E0JFIFq/* omitted many data here * /% F7*q%D6Q%EDt%F6%EE%7F%FF%D9 "/ >"
Generate picture data
According to the above format, we can write a Mini Program to generate, but we do not need to go to so much trouble, there are many websites offering this (free) service.
Here are a few:
1. Http://dataurl.sveinbjorn.org/dataurlmaker
Provide preview, easy to copy.
2. Http://websemantics.co.uk/online_tools/image_to_data_uri_convertor/
Provide a preview, but also generate the corresponding CSS URI data.
3. Http://software.hixie.ch/utilities/cgi/data/data
Tip: generation is not limited to image data, you can use three ways (see figure 1, 2, 3 below), you can specify the encoding method, but the interface is not friendly.
Used in group presentations
Click the insert / Edit Picture button:
Pop up the following window, use any of the above URLs, generate picture data, copy and paste into the picture address text box:
Click insert to OK, as shown below:
This is the end of the article on "how to use data URI scheme to embed pictures in the web page". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.