i got a very strange behavior when i tried to load image from cdvfile://
case 1:
i tried to load image with cordova camera.getPicture
with options:
{
destinationType: Camera.DestinationType.NATIVE_URI,
sourceType: Camera.PictureSourceType.SAVEDPHOTOALBUM,
correctOrientation: true
}
so in this case, with correctOrientation: true
, cordova made a copy of the original file and stored it in the app cache folder and in the callback i got the cache file path. Then i converted it into cdvfile, it worked perfectly.
case 2:
in case 1, i'm unhappy, because i want the original file path, so i can save it and reload it when i want.
so i changed a bit the code:
the fastest way is removing the option correctOrientation: true
so i get the originale file path, then with window.resolveLocalFileSystemURL
(same method in case 1), i get the cdvfile, i set it to image.src
and bam:
Failed to load resource: net::ERR_UNKNOWN_URL_SCHEME
so working perfectly with cached file:
file uri: file:///storage/emulated/0/Android/data/{app_id}/cache/IMG_20170119_091504.jpg?1484813705413
converted file url: cdvfile://localhost/cache-external/IMG_20170119_091504.jpg
not working with original file:
file uri: content://com.android.providers.media.documents/document/image%3A91315
converted into cdvfile: cdvfile://localhost/content/com.android.providers.media.documents/document/image%3A91316:1
i'm really confused... any ideas to solve this error?
im using:
- angular@1.6.1
- meteor@1.4.2.3
- bundled cordova-android@5.2.2
- cordova-plugin-camera@2.2.0
- cordova-plugin-file@4.2.0
- nexus7@6.0.1