I am using cordova camera plugin for capture the picture from gallery has below my code its working,Now i need to pass the URl to file reader,when i pass it to file reader it give me error Error in success callback: Camera1358190195 = TypeError: Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1 is not of type 'Blob' even for 'readAsBinarystring' not working need help below is my code.
//Cordova Camera Plugin
function PicfromGallery() {
var pictureSource = navigator.camera.PictureSourceType;
var destinationType = navigator.camera.DestinationType;
navigator.camera.getPicture(onSuccessEdituserProfileGallery, onFailEditProfileGallery, {
quality: 50,
sourceType: pictureSource.PHOTOLIBRARY,
destinationType: destinationType.FILE_URI,
targetWidth: 100,
targetHeight: 100
});
}
function onSuccessEdituserProfileGallery(imageData) {
var smallImage
smallImage = document.getElementById('userProfileImage');
//EditUserProfileImageFilename(imageData);
smallImage.src = imageData;
var userPic = document.getElementById('EdituserProfileImage');
var file = new File(imageData);
OnFileImageEntry(file)
}
//File API
function OnFileImageEntry(file) {
var reader = new FileReader();
reader.onload = function (event) {
var image = event.target.result;
image.onload = function () {
// need to get result
}
};
reader.readAsBinaryString(file);
}