arshad54 opened a new issue #640:
URL: https://github.com/apache/cordova-plugin-camera/issues/640


   # 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.
   
   ## Information
   <!-- Include all relevant information that might help understand and 
reproduce the problem -->
   Select image from gallery ,
   store its path then select another image then the previously selected image 
will be lost.
   
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   
   
       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
   <!-- In what environment, on what platform or on which device are you 
experiencing the issue? -->
   
   android 10 (samsung M30s)
   
   ### Version information
   <!-- 
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins 
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [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
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to