Skip to content

Instantly share code, notes, and snippets.

@mayroncachina
Created August 29, 2015 21:23
Show Gist options
  • Save mayroncachina/7cd64450238708b4536a to your computer and use it in GitHub Desktop.
Save mayroncachina/7cd64450238708b4536a to your computer and use it in GitHub Desktop.
Phonegap save picture on library
navigator.camera.getPicture(onSuccess, onFail,
{ quality: 25,
destinationType : Camera.DestinationType.FILE_URI,
sourceType : Camera.PictureSourceType.CAMERA,
allowEdit : true,
encodingType: Camera.EncodingType.JPEG,
//popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: true
});
function onSuccess(imageData) {
alert($scope.index)
$scope.$apply(function(){
$scope.index = $scope.index+1
$scope.imagens.push({"url":imageData, id: $scope.index, active:false})
});
console.log($scope.imagens)
}
function onFail(message) {
alert('Failed because: ' + message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment