Camara not save image

So, I’m taking the cordova plug the camera, I can take pictures and occupy within the application but I can not keep it inside my bibilioteca, I leave the code that I use now.

Camera.DestinationType = {
DATA_URL : 0,      // Return image as base64-encoded string
FILE_URI : 1,      // Return image file URI
NATIVE_URI : 2     // Return image native URI (e.g., assets-library:// on iOS or content:// on Android)
 };

  Camera.PictureSourceType = {
PHOTOLIBRARY : 0,
CAMERA : 1,
SAVEDPHOTOALBUM : 2
 };

 Camera.EncodingType = {
JPEG : 0,               // Return JPEG encoded image
PNG : 1                 // Return PNG encoded image
 };

 Camera.MediaType = {
PICTURE: 0,    // allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType
VIDEO: 1,      // allow selection of video only, WILL ALWAYS RETURN FILE_URI
ALLMEDIA : 2 
 };

 Camera.Direction = {
BACK : 0,      // Use the back-facing camera
FRONT : 1      // Use the front-facing camera
 };

 $scope.getPhoto = function() {
var options = {
  quality: 50,
  destinationType: Camera.DestinationType.DATA_URL,
  sourceType: Camera.PictureSourceType.CAMERA,
  allowEdit: true,
  encodingType: Camera.EncodingType.JPEG,
  targetWidth: 100,
  targetHeight: 100,
  popoverOptions: CameraPopoverOptions,
  saveToPhotoAlbum: false
};

Camera.getPicture(options).then(function(imageData) {
  var image = document.getElementById('myImage');
  image.src = "data:image/jpeg;base64," + imageData;
}, function(err) {
  // error
});
};

try using:
destinationType: Camera.DestinationType.FILE_URI
instead of …DATA_URL, then you should get file-path of the local filesystem an the image gets saved.

@bengtler I try, but it did not work … do not know what can it be? You maybe add another code?

ohh look you set:
saveToPhotoAlbum: false
:wink:

1 Like

jajajajaja, I also noticed recently xD lol Thanks for your help :slight_smile: