1.0.5 • Published 2 months ago

weimgtobase64 v1.0.5

Weekly downloads
1
License
ISC
Repository
github
Last release
2 months ago

weimgtobase64

中文

npm npm bundle size npm GitHub

install

npm install weimgtobase64
# common JS
const weimgtobase64 = require('weimgtobase64')
# es6
import weimgtobase64 from 'weimgtobase64'

use

// parse img url
const url = 'http://img.qipeiren.com/UploadFile/UserProPic/2019/11/23/4b65b8aadcfb0ac65a91.jpg'
console.log(weimgtobase64.parse(url))
// parse img object
const img = document.getElementById('test')
console.log(weimgtobase64.parse(img))
// useCanvas img object
const img = document.getElementById('test')
console.log(weimgtobase64.useCanvas(img))

function

functionparameterdefaultrequireddescription
parsestring/objectoptionala img object or img url
useCanvasobjectrequireda img object

tips

As soon as you draw into a canvas any data that was loaded from another origin without CORS approval, the canvas becomes tainted.A tainted canvas is one which is no longer considered secure, and any attempts to retrieve image data back from the canvas will cause an exception to be thrown.

wiki

  1. Allowing cross-origin use of images and canvas
1.0.5

2 months ago

1.0.4

2 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago