当前位置:网站首页>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 |
|
边栏推荐
- docker部署oracle
- electron remote 报错
- Docker deploy Oracle
- IP address home location query full version
- 潘多拉 IOT 开发板学习(HAL 库)—— 实验12 RTC实时时钟实验(学习笔记)
- JS get the current time, month, day, year, and the uniapp location applet opens the map to select the location
- Leetcode - Sword finger offer 05 Replace spaces
- 请问,redis没有消费消息,都在redis里堆着是怎么回事?用的是cerely 。
- 内部排序——插入排序
- Demis hassabis talks about alphafold's future goals
猜你喜欢

The longest ascending subsequence model acwing 482 Chorus formation

libSGM的horizontal_path_aggregation程序解读

MRS离线数据分析:通过Flink作业处理OBS数据

UML 顺序图(时序图)

【服务器数据恢复】某品牌StorageWorks服务器raid数据恢复案例

Internal sort - insert sort

GAN发明者Ian Goodfellow正式加入DeepMind,任Research Scientist

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

Transferring files between VMware and host
![Verilog implementation of a simple legv8 processor [4] [explanation of basic knowledge and module design of single cycle implementation]](/img/d3/20674983717d829489149b4d3bfedf.png)
Verilog implementation of a simple legv8 processor [4] [explanation of basic knowledge and module design of single cycle implementation]
随机推荐
Horizontal of libsgm_ path_ Interpretation of aggregation program
Common response status codes
小程序目录结构
Cascading update with Oracle trigger
C # use TCP protocol to establish connection
Search engine interface
Substance Painter筆記:多顯示器且多分辨率顯示器時的設置
内部排序——插入排序
云上“视界” 创新无限 | 2022阿里云直播峰会正式上线
Reading and understanding of eventbus source code
【立体匹配论文阅读】【三】INTS
Arm cortex-a9, mcimx6u7cvm08ad processor application
EMQX 5.0 发布:单集群支持 1 亿 MQTT 连接的开源物联网消息服务器
Vscode configuration uses pylint syntax checker
UML 状态图
Data connection mode in low code platform (Part 2)
UML 顺序图(时序图)
Beginner JSP
oracle 非自动提交解决
UML sequence diagram (sequence diagram)