I used this code:
function getPicture(){
navigator.camera.getPicture(onSuccess, onFail, {
quality: 50,
destinationType: Camera.DestinationType.FILE_URI,
sourceType : Camera.PictureSourceType.SAVEDPHOTOALBUM
});
}
function onSuccess(imageURI) {
img_uri = imageURI;
alert(img_uri);
Plugin.callNativeFunction(nativePluginResultHandler, nativePluginErrorHandler, 'success', img_uri);
}
I want to get a URI like this: "/mnt/sdcard/Pictures..." but the alert gave me a URI like "content://media/external/images/media/3915".
What can I do?
You can use window.resolveLocalFileSystemURI to get the true path. Your onSuccess method would look like:
function onSuccess(imageURI) {
img_uri = imageURI;
alert(img_uri);
window.resolveLocalFileSystemURI(img_uri, function(fileEntry) {
alert(fileEntry.fullPath);
Plugin.callNativeFunction(nativePluginResultHandler, nativePluginErrorHandler, 'success', fileEntry.fullPath);
}, onError);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With