{"action":"created","issue":{"url":"https://api.github.com/repos/nostra13/Android-Universal-Image-Loader/issues/699","labels_url":"https://api.github.com/repos/nostra13/Android-Universal-Image-Loader/issues/699/labels{/name}","comments_url":"https://api.github.com/repos/nostra13/Android-Universal-Image-Loader/issues/699/comments","events_url":"https://api.github.com/repos/nostra13/Android-Universal-Image-Loader/issues/699/events","html_url":"https://github.com/nostra13/Android-Universal-Image-Loader/issues/699","id":38286505,"number":699,"title":"Loading image from external storage(gallery/camera)","user":{"login":"fistuk","id":1989685,"avatar_url":"https://avatars.githubusercontent.com/u/1989685?v=3","gravatar_id":"","url":"https://api.github.com/users/fistuk","html_url":"https://github.com/fistuk","followers_url":"https://api.github.com/users/fistuk/followers","following_url":"https://api.github.com/users/fistuk/following{/other_user}","gists_url":"https://api.github.com/users/fistuk/gists{/gist_id}","starred_url":"https://api.github.com/users/fistuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fistuk/subscriptions","organizations_url":"https://api.github.com/users/fistuk/orgs","repos_url":"https://api.github.com/users/fistuk/repos","events_url":"https://api.github.com/users/fistuk/events{/privacy}","received_events_url":"https://api.github.com/users/fistuk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2014-07-21T09:08:49Z","updated_at":"2015-10-14T18:22:38Z","closed_at":null,"body":"Hi,\r\nWhen im trying to load an image from gallery or camera, im getting the following uri:\r\n/storage/emulated/0/Download/caffeine-crystals-big.jpg\r\n\r\nTo properly use UIL im constructing the following uri:\r\nfile:///storage/emulated/0/Download/caffeine-crystals-big.jpg\r\n\r\nWhile trying to load the image im getting the following errors:\r\n\r\nE/JHEAD﹕ can't open 'file:///storage/emulated/0/Download/caffeine-crystals-big.jpg'\r\nE/BitmapFactory﹕ Unable to decode stream: java.io.FileNotFoundException: /file:/storage/emulated/0/Download/caffeine-crystals-big.jpg: open failed: ENOENT (No such file or directory)\r\n\r\nOn the other hand BitmapFactory.decodeFile(imagePath) works perfectly with the same uri.\r\n \r\n"},"comment":{"url":"https://api.github.com/repos/nostra13/Android-Universal-Image-Loader/issues/comments/148144235","html_url":"https://github.com/nostra13/Android-Universal-Image-Loader/issues/699#issuecomment-148144235","issue_url":"https://api.github.com/repos/nostra13/Android-Universal-Image-Loader/issues/699","id":148144235,"user":{"login":"alexblack","id":148930,"avatar_url":"https://avatars.githubusercontent.com/u/148930?v=3","gravatar_id":"","url":"https://api.github.com/users/alexblack","html_url":"https://github.com/alexblack","followers_url":"https://api.github.com/users/alexblack/followers","following_url":"https://api.github.com/users/alexblack/following{/other_user}","gists_url":"https://api.github.com/users/alexblack/gists{/gist_id}","starred_url":"https://api.github.com/users/alexblack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexblack/subscriptions","organizations_url":"https://api.github.com/users/alexblack/orgs","repos_url":"https://api.github.com/users/alexblack/repos","events_url":"https://api.github.com/users/alexblack/events{/privacy}","received_events_url":"https://api.github.com/users/alexblack/received_events","type":"User","site_admin":false},"created_at":"2015-10-14T18:22:37Z","updated_at":"2015-10-14T18:22:37Z","body":"I found a work around.  The original URI is this one:\r\n\r\n`/storage/emulated/0/Android/data/com.dropbox.android/files/u13228039/scratch/Photos/2013-Feb%20Hannah/D71_0252.jpg`\r\n\r\nIt failed to load using UniversalImageLoader, with FileNotFoundException.  BitmapFactory.decodeFile loads it just fine.\r\n\r\nIf I then use https://github.com/iPaulPro/aFileChooser/blob/master/aFileChooser/src/com/ipaulpro/afilechooser/utils/FileUtils.java#L257 to get a filepath, then I get this uri:\r\n\r\n`/storage/emulated/0/Android/data/com.dropbox.android/files/u13228039/scratch/Photos/2013-Feb Hannah/D71_0252.jpg`\r\n\r\n(Same UI, but it has a space in it instead of %20, so I guess it just got decoded)\r\n\r\nThen it works fine with UniversalImageLoader.  So I first send the URI to UIL, then if it fails, I use getPath, then try again :)\r\n\r\n```\r\n      public void onLoadingFailed(final String imageUri, final View view, final FailReason failReason) {\r\n        // Try falling back if we fail to find the image\r\n        if (failReason.getCause() != null && failReason.getCause() instanceof FileNotFoundException) {\r\n          Log.d(TAG, \"Falling back to FilePickerUtils.getPath: \" + uri);\r\n          String path = FilePickerUtils.getPath(ctx, Uri.parse(uri));\r\n          final String fallbackUri = \"file://\" + path;\r\n          Log.d(TAG, \"FilePickerUtils.getPath result: \" + path);\r\n\r\n          ImageLoader.getInstance().loadImage(fallbackUri, size, options, new ImageLoadingListener() {\r\n```"}}