当前位置:网站首页>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 |
|
边栏推荐
- GVIM [III] [u vimrc configuration]
- Navigation — 这么好用的导航框架你确定不来看看?
- Ascend 910实现Tensorflow1.15实现LeNet网络的minist手写数字识别
- Multi merchant mall system function disassembly lecture 01 - Product Architecture
- Substance painter notes: settings for multi display and multi-resolution displays
- Codes de non - retour à zéro inversés, codes Manchester et codes Manchester différentiels couramment utilisés pour le codage des signaux numériques
- Regular expression integer positive integer some basic expressions
- 请问,PTS对数据库压测有好方案么?
- 【立体匹配论文阅读】【三】INTS
- 【愚公系列】2022年7月 Go教学课程 005-变量
猜你喜欢
Verilog implementation of a simple legv8 processor [4] [explanation of basic knowledge and module design of single cycle implementation]
2022年13个UX/UI/UE最佳创意灵感网站
Internal sort - insert sort
【历史上的今天】7 月 7 日:C# 发布;Chrome OS 问世;《仙剑奇侠传》发行
CVPR2022 | 医学图像分析中基于频率注入的后门攻击
Navigation - are you sure you want to take a look at such an easy-to-use navigation framework?
一个简单LEGv8处理器的Verilog实现【四】【单周期实现基础知识及模块设计讲解】
The longest ascending subsequence model acwing 1014 Mountaineering
今日睡眠质量记录78分
Data flow diagram, data dictionary
随机推荐
Mrs offline data analysis: process OBS data through Flink job
Cargo placement problem
低代码平台中的数据连接方式(下)
c#利用 TCP 协议建立连接
NDK beginner's study (1)
GVIM [III] [u vimrc configuration]
解析PHP跳出循环的方法以及continue、break、exit的区别介绍
LeetCode每日一题(636. Exclusive Time of Functions)
Verilog implementation of a simple legv8 processor [4] [explanation of basic knowledge and module design of single cycle implementation]
Oracle non automatic submission solution
Demis hassabis talks about alphafold's future goals
oracle 触发器实现级联更新
搜索引擎接口
小程序目录结构
一个程序员的水平能差到什么程度?尼玛,都是人才呀...
常用數字信號編碼之反向不歸零碼碼、曼徹斯特編碼、差分曼徹斯特編碼
Leetcode——236. The nearest common ancestor of binary tree
UML sequence diagram (sequence diagram)
Arm cortex-a9, mcimx6u7cvm08ad processor application
Bashrc and profile