I am using cordova ImagePicker plugin for selecting images from device gallery. Image picker transfers image into application cache, so that I used the $cordovaFile.moveFile function for moving image files into app’s files directory. This is process is being done successfully, because console.log("Native URL: "+ success.toURL()); is returning the following log:
image path is being stored by using this code $scope.slides.push({“filepath”:success.toURL()});
In my view I am using following code for image slide:
You CAN’T use Image Picker URI and display it inside an img tag, it will not work. On the other hand, you can convert that URI into BASE64 string and then inject it into img tag.
window.plugins.Base64.encodeFile($scope.collection.selectedImage, function(base64){ // Encode URI to Base64 needed for contacts plugin
$scope.collection.selectedImage = base64;
});
Hey! I’m using here the window.imagePicker.getPictures(...) with base64 encode and… seems to show up tiny thumbnails like if the images were missing or something:
hello,
Is your file getting saved? In case yes, may be the mediascanner is not triggered before you do a read of the file. Since the mediascanner is not triggered, so content provider wont have the entry for your file (your file is not indexed).In case your file is getting saved with “saveIamgeToLocalStore”, then trigger mediascanner from code once like this:
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri
.parse(“file://”
+ Environment.getExternalStorageDirectory())));
and then do a read on the file. It should work.