I have been developing an App with Phonegap.
I use the camera plugin. If I get a photo from the library over the plugin, I get the picurl. I save the url in localStorage and display the pic with html in the app. That works good.
After an app restart, I want to display the same pic again, but now the picurl is invalid. It is the same path like the first time, but now it is invalid.
Get Photo:
pictureSource = navigator.camera.PictureSourceType;
destinationType = navigator.camera.DestinationType;
navigator.camera.MediaType = 0;
navigator.camera.getPicture(onPhotoURISuccess, onFail, {
quality: 50,
destinationType: destinationType.FILE_URI,
mediaType: navigator.camera.MediaType.PICTURE,
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
});
function onPhotoURISuccess(imageURI) {
localStorage.pic = imageURI;
$scope.$apply(function () {
var html = '<img id="img1" src="' + imageURI + '" />';
$scope.photogallery = html;
}
)
}
For testing purposes, I added the picurl in my view:
<img ng-src="picurl" />
After the restart it is no pic in my view. If I watch it with the inspector in my browser, I see the right url. But it is invalid.
It seems that the plugin load the pic in a "tmp"-folder with a name like "cdv_photo_001.jpg" If i put the same pic from the library again, I get the same url in the "tmp"-folder with the file name "cdv_photo_002.jpg". Is there an option to get a persistent url on the device. Not a temporary folder with pics.