This article is a mirror article of machine translation, please click here to jump to the original article.

View: 9180|Reply: 0

[JavaScript] JavaScript implements the transfer of image resources (base64, blob) to each other and upload them to the server

[Copy link]
Posted on 3/14/2019 11:13:46 AM | | |
1. Convert the locally uploaded image into a dataUrl for image preview, which can be used
URL.createObjectURL(Blob/File) or FileReader, refer tohttps://www.cnblogs.com/zhangdiIT/p/7895903.html

2. Convert local images to base64, you can use FileReader
3. Convert images on the web to base64, using canvas.toDataURL()
4. To convert base 64 to blob, you can use canvas.toDataURL()
5. Submit the base64 image to the server







Previous:Newcomer reports
Next:Using jQuery to empty the file file field
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com