当前位置:网站首页>JS image to Base64
JS image to Base64
2022-07-07 14:28:00 【Snail games】
This article mainly introduces js Picture turn base64 The way , Now share with you , Also give you a reference .
Mode one :Blob and FileReader object
Realization principle :
Use xhr Ask for pictures , And set the returned file type as Blob object [xhr.responseType = "blob"]
Use FileReader Object reception blob
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
Mode two :canvas.toDataURL() Method
Realization principle :
Use canvas.toDataURL() Method
Need to solve the cross domain problem of pictures image.crossOrigin = '';
Used Jquery Library $.Deferred() Method
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
边栏推荐
- Excuse me, as shown in the figure, the python cloud function prompt uses the pymysql module. What's the matter?
- 今日睡眠质量记录78分
- Cascading update with Oracle trigger
- Leetcode——236. 二叉树的最近公共祖先
- Oracle non automatic submission solution
- Navigation - are you sure you want to take a look at such an easy-to-use navigation framework?
- Reverse non return to zero code, Manchester code and differential Manchester code of common digital signal coding
- [untitled]
- Notes de l'imprimante substance: paramètres pour les affichages Multi - écrans et multi - Résolutions
- Use case diagram
猜你喜欢

云上“视界” 创新无限 | 2022阿里云直播峰会正式上线

UML 状态图

2022pagc Golden Sail award | rongyun won the "outstanding product technology service provider of the year"

【愚公系列】2022年7月 Go教学课程 005-变量

Simple use of websocket

华为云数据库DDS产品深度赋能

SAKT方法部分介绍

Reverse non return to zero code, Manchester code and differential Manchester code of common digital signal coding

通过 iValueConverter 给datagrid 的背景颜色 动态赋值

UML 顺序图(时序图)
随机推荐
Demis hassabis talks about alphafold's future goals
Vscode configuration uses pylint syntax checker
Common response status codes
Substance Painter笔记:多显示器且多分辨率显示器时的设置
Docker deploy Oracle
[AI practice] Application xgboost Xgbregressor builds air quality prediction model (II)
潘多拉 IOT 开发板学习(HAL 库)—— 实验12 RTC实时时钟实验(学习笔记)
半小时『直播连麦搭建』动手实战,大学生技术岗位简历加分项get!
一文读懂数仓中的pg_stat
今日睡眠质量记录78分
最长上升子序列模型 AcWing 482. 合唱队形
Differences between cookies and sessions
Excuse me, does PTS have a good plan for database pressure measurement?
Environment configuration
Introduction to sakt method
UML 状态图
C # use TCP protocol to establish connection
昇腾体验官第五期随手记I
Excuse me, I have three partitions in Kafka, and the flinksql task has written the join operation. How can I give the join operation alone
【服务器数据恢复】某品牌StorageWorks服务器raid数据恢复案例