Base64 is one of the most common encoding methods for transmitting 8Bit byte codes on the Internet. Base64 encoding can be used to transmit longer identification information in the HTTP environment. The use of Base64 encoding is unreadable, that is, the encoded data will not be directly seen by the naked eye.
Base64 encoding requires that 3 8-bit bytes (3*8=24) be converted into 4 6-bit bytes (4*6=24), and then two 0s are added in front of the 6 bits to form an 8-bit word section form. If the remaining characters are less than 3 bytes, it is padded with 0 and the output character is '=', so 1 or 2 '=' may appear at the end of the encoded output text.
1. Support PNG, GIF, JPG, BMP, ICO formats.
2. Converting pictures into base64 encoding, which is generally used for small pictures on the web, can not only reduce the number of pictures requested (collected into js and css codes), but also prevent picture 404 errors due to some relative paths and other issues.
3. Assuming that the generated code is "data:image/jpeg;base64, .....", then you only need to copy it all, and then fill in this code when inserting the image:
Use in CSS: background-image: url("data:image/png;base64,iVBORw0KGgo=...");
HTML use: <img src="data:image/png;base64,iVBORw0KGgo=..." />