我试图以sudo hwclock -D -r
的形式从图库或android的照相机中获取图像
然后使用fileURI
resolveLocalFilesystemUrl
然后:
const options: CameraOptions = {
quality: 100,
correctOrientation: true,
destinationType: this.camera.DestinationType.FILE_URI,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
sourceType: sourceType
}
我得到的图像数据是:
// Get the picture
this.camera.getPicture(options).then((imageData) => {
console.log("now here !");
console.log(imageData);
我遇到的错误是 “ this.file.resolveLocalFilesystemUrl(imageData)”
file:///storage/emulated/0/Android/data/io.ionic.app5/cache/IMG-20180802-WA0004.jpg?1533286934006
错误是:
let loading = this.loadingCtrl.create();
loading.present();
console.log(imageData);
// Resolve the picture URI to a file
this.file.resolveLocalFilesystemUrl(imageData).then(oneFile => {
// Convert the File to an ArrayBuffer for upload
this.file.readAsArrayBuffer(this.file.tempDirectory, oneFile.name).then(realFile => {
let type = 'jpg';
let newName = this.awsProvider.randomString(6) + new Date().getTime() + '.' + type;