for-compress
v0.0.3
Published
1. 压缩 ✅ 2. 非图片校验✅ 3. 返回file, base64, Blob, bloburl, 原图大小, 压缩后大小✅ 4. 错误处理✅ 5. ios exif图片翻转问题解决✅ 6. demo✅ 7. 成功回调,失败回调 ✅
Downloads
7
Readme
介绍
TODO & DONE
- 压缩 ✅
- 非图片校验✅
- 返回file, base64, Blob, bloburl, 原图大小, 压缩后大小✅
- 错误处理✅
- ios exif图片翻转问题解决✅
- demo✅
- 成功回调,失败回调 ✅
使用
安装
npm i for-compress
页面使用
<input type="file" placeholder="图片上传" id="upload" accept="image/*" />
import Compress from 'for-compress
document.getElementById('upload').addEventListener('change', event => {
new Compress(event.target.files[0], {
success: res => {
console.log(res);
},
fail: err => {
console.log(err);
}
})
})