Advertisement
Guest User

Untitled

a guest
Jan 5th, 2017
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. choose_picture()
  2. {
  3.     let actionSheet = this.ActionSheetController.create({
  4.         buttons: [
  5.             {
  6.                 icon: 'camera',
  7.                 text: this.translate.instant('From Camera'),
  8.                 handler: () => {
  9.                     Camera.getPicture({
  10.                         destinationType: 0,
  11.                         sourceType: 1,
  12.                         saveToPhotoAlbum: false,
  13.                         targetWidth: 500,
  14.                         targetHeight: 500,
  15.                         allowEdit: true,
  16.                     }).then(
  17.                         (imageData) => {
  18.                             this.picture = 'data:image/jpeg;base64,' + imageData;
  19.                         },
  20.                         (err) => {
  21.                             console.log('Error', err);
  22.                         });
  23.                 }
  24.             },
  25.             {
  26.                 icon: 'image',
  27.                 text: this.translate.instant('From Gallery'),
  28.                 handler: () => {
  29.                     Camera.getPicture({
  30.                         destinationType: 0,
  31.                         sourceType: 2,
  32.                         saveToPhotoAlbum: false,
  33.                         targetWidth: 500,
  34.                         targetHeight: 500,
  35.                         allowEdit: true,
  36.                     }).then(
  37.                         (imageData) => {
  38.                             this.picture = 'data:image/jpeg;base64,' + imageData;
  39.                         },
  40.                         (err) => {
  41.                             console.log('Error', err);
  42.                         });
  43.                 }
  44.             },
  45.             {
  46.                 icon: 'close',
  47.                 text: this.translate.instant('Cancel'),
  48.                 role: 'cancel',
  49.                 handler: () => {
  50.                     //console.log('Cancel clicked');
  51.                 }
  52.             }
  53.         ]
  54.     });
  55.  
  56.     actionSheet.present();
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement