我尝试从相机拍摄照片并将拍摄的照片复制到新目录并使用新名称。我正确地创建了我的目录,但是当将图像从相机文件夹复制到新文件夹时,它警告我该错误:ENCODING_ERR
这是我的代码:
Image: any;
takePicture() {
var options = {
quality: 100,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
saveToPhotoAlbum: true,
};
// Get the data of an image
this.camera.getPicture(options).then((imageData) => {
// imageData is either a base64 encoded string or a file URI
// If it's base64 (DATA_URL):
this.Image= "data:image/jpeg;base64," + imageData;
this.currentName = this.Image.replace(/^.*[\\\/]/, '');
this.correctPath = this.Image.substr(0, this.Image.lastIndexOf('/') +
1);
}, (err) => {
// Handle error
});
}