cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [cordova-plugin-camera] arshad54 opened a new issue #640: Empty filename (.Pic.) when selecting image from gallery causes invalid file path and unable to differentiate multiple images because of the same name
Date Tue, 04 Aug 2020 18:49:18 GMT

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message