Iam using cordova 3.4. When i capture an image and set it,its working fine but when I try to access on image from gallery I get the url
content://com.android.providers.media.documents/document/image%4A463
and I get image load error in my image tag.I know this is a know bug going around and I have refered stack questions such as Unable to load image when selected from the gallery on Android 4.4 (KitKat) using PhoneGap Camera Plugin
I cannot use the rough work around mentioned where URI is set manually like content://media/external/images/media/ because we focus devices with internal built in storage such as Moto
Also can you please confirm that this issue has been fixed in cordova 3.5.Because I require permission from my officials for download and I must make sure it is achievable .Can somebody please help
UPDATE:
app.directive('upload', function() {
return {
restrict: 'A',
require: 'ngModel',
link: function(scope, elm, attrs, ctrl) {
elm.on('click', function() {
navigator.camera.getPicture(
function(imageURI) {
scope.$apply(function() {
alert(imageURI);
ctrl.$setViewValue(imageURI);
});
window.resolveLocalFileSystemURI(imageURI, function(fileEntry) {
// ctrl.$setViewValue(imageURI);
alert("inside local file" + imageURI);
alert("Inside local file system");
fileEntry.file(function(fileObj) {
alert("hai");
var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = fileObj.name;
options.mimeType = fileObj.type;
var ft = new FileTransfer();
// var url = fileUploadUrl;
// ft.upload(imageUri, encodeURI(url), success, failure, options);
});
});
},
function(err) {
ctrl.$setValidity('error', false);
}, {quality: 50,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY
}
);
});
}
};
});
My HTML:
<img
ng-src="{{onepic}}"
width="250"
height="390"
alt="error"/>
I set value for onepic in my controller inside watch function.So when directive returns a URI it will be automatically set in onepic.Please specify any alternative solution or if Iam doing anything wrong ,Iam new to angularjs