当前位置:网站首页>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 |
|
边栏推荐
- 昇腾体验官第五期随手记I
- Pert diagram (engineering network diagram)
- GAN发明者Ian Goodfellow正式加入DeepMind,任Research Scientist
- Leetcode——236. 二叉树的最近公共祖先
- Multi merchant mall system function disassembly lecture 01 - Product Architecture
- IP address home location query full version
- Mrs offline data analysis: process OBS data through Flink job
- MRS离线数据分析:通过Flink作业处理OBS数据
- ARM Cortex-A9,MCIMX6U7CVM08AD 处理器应用
- Seven propagation behaviors of transactions
猜你喜欢
LeetCode每日一题(636. Exclusive Time of Functions)
一个程序员的水平能差到什么程度?尼玛,都是人才呀...
Multi merchant mall system function disassembly lecture 01 - Product Architecture
The longest ascending subsequence model acwing 482 Chorus formation
Beginner JSP
Docker deploy Oracle
libSGM的horizontal_path_aggregation程序解读
Navigation - are you sure you want to take a look at such an easy-to-use navigation framework?
UML sequence diagram (sequence diagram)
2022pagc Golden Sail award | rongyun won the "outstanding product technology service provider of the year"
随机推荐
VSCode 配置使用 PyLint 语法检查器
OAuth 2.0 + JWT 保护API安全
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
小米的芯片自研之路
Excuse me, does PTS have a good plan for database pressure measurement?
Cvpr2022 | backdoor attack based on frequency injection in medical image analysis
Excusez - moi, l'exécution a été réussie lors de l'utilisation des données de puits SQL Flink à Kafka, mais il n'y a pas de nombre dans Kafka
Search engine interface
First choice for stock account opening, lowest Commission for stock trading account opening, is online account opening safe
NLLB-200:Meta开源新模型,可互译200种语言
IP address home location query full version
Selenium Library
半小时『直播连麦搭建』动手实战,大学生技术岗位简历加分项get!
请问,在使用flink sql sink数据到kafka的时候出现执行成功,但是kafka里面没有数
属性关键字ServerOnly,SqlColumnNumber,SqlComputeCode,SqlComputed
最长上升子序列模型 AcWing 482. 合唱队形
The longest ascending subsequence model acwing 482 Chorus formation
Oracle Linux 9.0 officially released
2022云顾问技术系列之高可用专场分享会
ARM Cortex-A9,MCIMX6U7CVM08AD 处理器应用