this is how am capturing my image
$scope.takePhoto = function () {
var camera_options = { // CONFIG 1. CAMERA SETTINGS
quality: 80,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.CAMERA,
allowEdit: false,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 100,
targetHeight: 100,
correctOrientation: true,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: false
};
$cordovaCamera.getPicture(camera_options).then(function (imageData) {
//$scope.imgSrc = "data:image/jpeg;base64," + imageData;
$scope.imgSrc = imageData;
$scope.imgData = imageData;
$scope.$apply();
}, function (err) {
$cordovaDialogs.alert('Picture Not Taken', 'Error', 'OK');
});
}
After that am trying to save the image to internal memory on android this way
$cordovaFile.writeFile(cordova.file.externalRootDirectory, 'app/profile/' + data.id + '.jpeg', $scope.imgSrc, {'append': false}).then(function (result) {
$cordovaDialogs.alert('Image saved', 'Success', 'OK');
}, function (err) {
// An error occured. Show a message to the user
$cordovaDialogs.alert('Image not saved', 'Error', 'OK');
});
The image saved can not be opened its very small 9bytes only . What am I doing wrong ?