Open
Description
Bug Report
Problem
Empty filename (.Pic.) causes invalid file path and unable to differentiate multiple images because of the same name
What is expected to happen?
There should be different filenames for multiple files
What does actually happen?
It renames every empty filename to .Pic.jpg to every file selected from the gallery but then its complicated to differ this images as there are multiple images with same name.
NOTE:- updating cameraLauncher.java file from renaming empty filename to timestamp works for me , instead of (.Pic.)
Information
Select image from gallery ,
store its path then select another image then the previously selected image will be lost.
Command or Code
await this.camera.getPicture(this.options).then(async (imageData) => {
this.errorFlag['imageError'] = false;
// imageData is either a base64 encoded string or a file URI
// If it's base64 (DATA_URL):
// let base64Image = 'data:image/jpeg;base64,' + imageData;
//this.imgSrc = this.sanitizer.bypassSecurityTrustUrl("data:Image/*;base64," + imageData);
// let paths = await this.filePath.resolveNativePath(imageData);
console.log("imageData",imageData);
if(imageData.includes("?")){
imageData.split("?")[0];
let fileName = imageData.split("?")[0].split('/').pop();
let path = imageData.split("?")[0].substring(0, imageData.split("?")[0].lastIndexOf("/") + 1);
this.file.readAsDataURL(path, fileName)
.then(base64File => {
this.imagesArray.push(base64File);
this.imagePathArray.push(imageData);
})
.catch(() => {
console.log('Error reading file');
})
}
});
Environment, Platform, Device
android 10 (samsung M30s)
Version information
Checklist
- [x ] I searched for existing GitHub issues
- [x ] I updated all Cordova tooling to most recent version
- [x ] I included all the necessary information above