Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. function TakePicture()
  2. {
  3. event.preveDefault();
  4. if (!navigator.camera) {
  5. OpenModalDialog('Alert', 'Camera API not supported', '80%', '20%');
  6. return;
  7. }
  8. var options = {
  9. quality: 50,
  10. destinationType: Camera.DestinationType.FILE_URI,
  11. sourceType: 1, // 0:Photo Library, 1=Camera, 2=Saved Album
  12. encodingType: 0, // 0=JPG 1=PNG
  13. saveToPhotoAlbum: true
  14. };
  15.  
  16. navigator.camera.getPicture(
  17. function (imageData) {
  18. window.resolveLocalFileSystemURI(imageURI, resolveOnSuccess, fsFail);
  19. //$('.employee-image', this.el).attr('src', "data:image/jpeg;base64," + imageData);
  20. // var image = document.getElementById('myImage');
  21. // image.src = imageURI;
  22. },
  23. function () {
  24. OpenModalDialog('Alert', 'Error taking picture', '80%', '20%');
  25. },
  26. options);
  27.  
  28. return false;
  29.  
  30. }
  31. function Browse()
  32. {
  33.  
  34.  
  35. if (!navigator.camera) {
  36. OpenModalDialog('Alert', 'Camera API not supported', '80%', '20%');
  37. return;
  38. }
  39. navigator.camera.getPicture(onSuccess, onFail, {
  40. quality: 50,
  41. destinationType: navigator.camera.DestinationType.FILE_URI,
  42. sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
  43. });
  44.  
  45.  
  46. function onSuccess(imageData) {
  47. // var image = document.getElementById('myImage');
  48. // image.src = "data:image/jpeg;base64," + imageData;
  49. }
  50.  
  51. function onFail(message) {
  52. OpenModalDialog('Alert', 'Failed because: ' + message, '80%', '20%');
  53. }
  54. }
  55.  
  56. function onDeviceReady() {
  57. OpenModalDialog('Alert', 'navigator' + navigate.camera, '80%', '20%');
  58. // OpenModalDialog('Alert',' Camera '+navigator.camera,'80%','20%');
  59. }
  60.  
  61.  
  62. help me..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement