将heic格式的图片转换成jpg发送给后端,安装heic2any之后报错ReferenceError: Blob is not defined,哪位大神遇到过求解?
步骤:
1 npm i heic2any
2 import heic2any from 'heic2any'
3
heic2any({
blob: 文件路径,
toType: "image/jpg",
})
.then((blob) => {
console.log('转换结果',blob)
const fileReader = new FileReader()
const url = fileReader.readAsDataURL()
console.log('url====', url)
})
.catch((e) => {
// see error handling section
console.log('some error',e)
})
小程序里没有 Blob 类型。
传给后端让后端转码吧。