Hello everyone i am new on ionic my objective is that a person can take a picture from camera offline and some data stores in local storage against the name of so far i was able to save image and some data against that in local storage but whenever i select that picture from gallery it comes with different url and name can any 1 tell me how to get the title of image ? here is my code
$scope.choosePhoto = function () {
var options = {
quality: 75,
destinationType: Camera.DestinationType.NATIVE_URI,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
allowEdit: false,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 300,
targetHeight: 300,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: false
};
$cordovaCamera.getPicture(options).then(function (imageData) {
$scope.showImage = true;
$scope.showFormPickup = false;
$scope.showSeatAvaiable = false;
$scope.showRequestWating = false;
$rootScope.aloTaxiHeaderBarClass = 'overlay';
$scope.imgURI = imageData;
//Store File URL in variable
$scope.fileUrL = imageData;
alert("Image URL:" + $scope.imgURI);
var filename= $scope.fileUrL.split("?").pop();
//alert(filename);
filename = filename.substr(0,filename.length);
//alert(filename);
try {
var item = angular.fromJson(localStorage.getItem(filename));
//alert(item);
$scope.latitude = item["latitude"];
$scope.longitude = item["longitude"];
//alert($scope.latitude);
//alert($scope.longitude);
}
catch (err)
{
//alert(err);
}
}, function (err) {
console.log('Error While getting pictures from gallery' + err);
});
}