Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. var options = {
  2. quality: 50,
  3. destinationType: Camera.DestinationType.FILE_URI,
  4. sourceType: Camera.PictureSourceType.CAMERA,
  5. allowEdit: true,
  6. encodingType: Camera.EncodingType.JPEG,
  7. popoverOptions: CameraPopoverOptions,
  8. saveToPhotoAlbum: false,
  9. correctOrientation: true
  10. };
  11.  
  12. $cordovaCamera.getPicture(options).then(function(sourcePath) {
  13. // alert("inside pic from sourcePath: " + sourcePath);
  14. var sourceDirectory = sourcePath.substring(0, sourcePath.lastIndexOf('/') + 1);
  15.  
  16. var sourceFileName = sourcePath.substring(sourcePath.lastIndexOf('/') + 1, sourcePath.length);
  17. $cordovaFile.copyFile(sourceDirectory, sourceFileName, cordova.file.dataDirectory, sourceFileName).then(function(success) {
  18. $scope.uploadedImage = cordova.file.dataDirectory + sourceFileName;
  19. $scope.closeChoosephoto();
  20. }, function(error) {
  21. console.dir(error);
  22.  
  23. });
  24.  
  25. }, function(err) {
  26. console.log(err);
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement