You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/08/04 19:04:03 UTC

[GitHub] [cordova-plugin-camera] arshad54 opened a new pull request #641: Update empty filename issue for supporting multiple images

arshad54 opened a new pull request #641:
URL: https://github.com/apache/cordova-plugin-camera/pull/641


   <!--
   Please make sure the checklist boxes are all checked before submitting the PR. The checklist is intended as a quick reference, for complete details please see our Contributor Guidelines:
   
   http://cordova.apache.org/contribute/contribute_guidelines.html
   
   Thanks!
   -->
   
   ### Platforms affected
   
   
   
   ### Motivation and Context
   <!-- Why is this change required? What problem does it solve? -->
   <!-- If it fixes an open issue, please link to the issue here. -->
   
   I was stucked from few days because i am not able to get correct path for the images selected using PHOTOALBUM but then i got a new problem after rectifying the issue i found that the cameraLauncher.java file renaming every image selected from gallery to .Pic. therefore its very difficult to differentiate them and also it is overriding the images.
   
   
   ### Description
   <!-- Describe your changes in detail -->
   
   This is required to differ between multiple images as the java file renaming every file to .Pic. so instead this i added timestamp to the empty filename so that the developer can able to differentiate between multiple files and their paths.
   
   ### Testing
   <!-- Please describe in detail how you tested your changes. -->
   I have tested this on android 10 using camera and gallery app in my device and it is working fine.
   
   
   ### Checklist
   
   - [x ] I've run the tests to see all new and existing tests pass
   - [ ] I added automated test coverage as appropriate for this change
   - [ ] Commit is prefixed with `(platform)` if this change only applies to one platform (e.g. `(android)`)
   - [ ] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct [keyword to close issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/))
   - [ ] I've updated the documentation if necessary
   


----------------------------------------------------------------
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


[GitHub] [cordova-plugin-camera] erisu commented on a change in pull request #641: (android) Update empty filename issue for supporting multiple images

Posted by GitBox <gi...@apache.org>.
erisu commented on a change in pull request #641:
URL: https://github.com/apache/cordova-plugin-camera/pull/641#discussion_r827610468



##########
File path: src/android/CameraLauncher.java
##########
@@ -335,7 +335,9 @@ private File createCaptureFile(int encodingType) {
      */
     private File createCaptureFile(int encodingType, String fileName) {
         if (fileName.isEmpty()) {
-            fileName = ".Pic";
+            //creating timestamps for empty filename to differentiate between multiple files selected via gallery
+            String timeStamp = new SimpleDateFormat(TIME_FORMAT).format(new Date());
+            fileName = timeStamp;

Review comment:
       ```suggestion
               // Append the current time in milliseconds for empty filename to differentiate between multiple files selected via gallery
               fileName = ".Pic-" + System.currentTimeMillis();
   ```
   
   IMO, I would suggest the above.
   
   What you have might work to a certain point.
   
   The `TIME_FORMAT`'s lowest placement is in seconds. 
   
   Could someone take burst shots and therefore have many photos per second. Using `System.currentTimeMillis` might help out a bit since it's now in milliseconds.
   
   Example filename with the above code would be: `.Pic-1647402802991`
   
   I would not recommend updating the value of `TIME_FORMAT`. If changed, then the PR becomes a major breaking PR.
   
   To keep or not to keep the `".Pic-"` prefix is questionable? If it is kept as a prefix, then it could be used as a keyword filter when grabbing all files with the `.Pic` prefixed. I don't know if this is necessary, but I also don't know what other files exist in the same directory.
   
   What do you think?




-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

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