base64 simply, it translates some 8-bit data into standard ASCII characters, and we write the contents of the image file directly in the HTML file, and the benefit is that an HTTP request is saved
Data URI Scheme. Data URI scheme is defined in RFC2397 to embed some small data directly into a Web page so that no longer has to be loaded from an external file. For example, the above string of characters, in fact, is a small picture, these characters will be copied sticky paste into the address bar of Firefox and go to, you can see it, a 2*2 of white gif pictures. In the data URI above, data represents the contract name for the acquisition, Image/gif is the data type name, base64 is the encoding method of the data, followed by the Image/gif file Base64 encoded data. Currently, data URI scheme supports types with: data:, text data:text/plain, text data data:text/html,html code data: TEXT/HTML;BASE64,BASE64 encoded HTML code DATA:TEXT/CSS,CSS code DATA:TEXT/CSS;BASE64,BASE64 encoded CSS code data: Text/javascript,javascript code DATA:TEXT/JAVASCRIPT;BASE64,BASE64 coded JavaScript code DATA:IMAGE/GIF;BASE64 , base64 encoded GIF image data DATA:IMAGE/PNG;BASE64,BASE64 encoded PNG picture data DATA:IMAGE/JPEG;BASE64,BASE64 encoded JPEG image data DATA:IMAGE/X-ICON;BASE64,BASE64 encoded icon image data Base64 simply, it translates some 8-bit data into standard ASCII characters, and there's a lot of free base64 online Coding and decoding tools that can be encoded in PHP using function Base64_encode (), such as Echo Base64_encode (file_get_contents (' images/log.gif ')); , IE8, Firfox, Chrome, opera browsers all support this small file embedding. Give an example of a picture: a picture in a Web page can be shown like this: code as follows: <img src= "Log.gif"/> can also display: code as follows: <img src= "Data:image/gif;base64, R0lgodlhagacaiaaap///waaacwaaaaaagacaaacaorrads= "/> We wrote the contents of the image file directly in the HTML file, the benefit of which is to save an HTTP request. The downside is that browsers do not cache this image.