我正在使用此代码制作base64图像,但出现错误:
const options: CameraOptions = {
quality: 100,
allowEdit: true,
sourceType: source,
saveToPhotoAlbum: true,
correctOrientation: true,
encodingType: this.camera.EncodingType.JPEG,
destinationType: this.camera.DestinationType.FILE_URI
}
this.camera.getPicture(options).then((imageData) => {
//needs to import file plugin
//split the file and the path from FILE_URI result
let filename = imageData.substring(imageData.lastIndexOf('/')+1);
let path = imageData.substring(0,imageData.lastIndexOf('/')+1);
//then use the method reasDataURL btw. var_picture is ur image variable
this.file.readAsDataURL(path, filename).then(res=> var_picture = res );
})
ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'split' of undefined
所以也许有人知道这里真正的问题是什么?非常感谢。