Github user riknoll commented on a diff in the pull request:

    
https://github.com/apache/cordova-plugin-camera/pull/149#discussion_r50165621
  
    --- Diff: src/android/FileHelper.java ---
    @@ -79,50 +79,72 @@ public static String getRealPath(String uriString, 
CordovaInterface cordova) {
         @SuppressLint("NewApi")
         public static String getRealPathFromURI_API19(Context context, Uri 
uri) {
             String filePath = "";
    +   Cursor cursor = null;
    +
             try {
    -            String wholeID = DocumentsContract.getDocumentId(uri);
    +             String wholeID = DocumentsContract.getDocumentId(uri);
     
                 // Split at colon, use second item in the array
                 String id = wholeID.indexOf(":") > -1 ? wholeID.split(":")[1] 
: wholeID.indexOf(";") > -1 ? wholeID
                         .split(";")[1] : wholeID;
     
    -            String[] column = { MediaStore.Images.Media.DATA };
    +       // @dlogo 20151210 Get type to check wheter is image or video
    +       String type = wholeID.indexOf(":") > -1 ? wholeID.split(":")[0] : 
wholeID.indexOf(";") > -1 ? wholeID
    +                    .split(";")[0] : wholeID;
    +
    +       Uri contentUri = null;
    +            if ("image".equals(type)) {
    +                contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
    +            } else if ("video".equals(type)) {
    +                contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
    +            } else if ("audio".equals(type)) {
    +                contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
    +            }
    +
    +       String[] column = { "_data" };
    --- End diff --
    
    Instead of hardcoding "_data", it looks like you can reference it from the 
base class that images/video/audio inherit from 
http://developer.android.com/reference/android/provider/MediaStore.MediaColumns.html


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org

Reply via email to