當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ionic-native.Camera類代碼示例

本文整理匯總了TypeScript中ionic-native.Camera的典型用法代碼示例。如果您正苦於以下問題:TypeScript Camera類的具體用法?TypeScript Camera怎麽用?TypeScript Camera使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Camera類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: takePicture

 takePicture(){
   Camera.getPicture({
       destinationType: Camera.DestinationType.DATA_URL,
       targetWidth: 1000,
       targetHeight: 1000
   }).then((imageData) => {
     // imageData is a base64 encoded string
       this.base64Image = "data:image/jpeg;base64," + imageData;
   }, (err) => {
       console.log(err);
   });
 }
開發者ID:geraldasd,項目名稱:SGSL-21-JULY,代碼行數:12,代碼來源:camera.ts

示例2: takePhoto

  takePhoto(){
    Camera.getPicture({
      quality: 100,
      cameraDirection: Camera.Direction.FRONT,
      destinationType: Camera.DestinationType.DATA_URL
    }).then((imageData) => {
      let base64Image = 'data:image/jpeg;base64,' + imageData;
      this.image = base64Image;
    }, (err) => {

    });
  }
開發者ID:arthurbragaa,項目名稱:ionic2-native,代碼行數:12,代碼來源:camera-test.ts

示例3: openCamera

 openCamera() {
   var options = {
     sourceType: Camera.PictureSourceType.CAMERA,
     destinationType: Camera.DestinationType.DATA_URL
   };
   Camera.getPicture(options).then((imageData) => {
     this.cameraData = 'data:image/jpeg;base64,' + imageData;
     this.photoTaken = true;
     this.photoSelected = false;
   }, (err) => {
     // Handle error
   });
 }
開發者ID:ivanthecrazy,項目名稱:devfanaticblog-camera-upload,代碼行數:13,代碼來源:home.ts

示例4: takePicture

  takePicture(){
    let options = {
      destinationType: Camera.DestinationType.DATA_URL,
      targetWidth: 1000,
      targetHeight: 1000,
      quality: 100
    }

    Camera.getPicture( options )
    .then(imageData =>{
      this.image = 'data:image/jpeg;base64,' + imageData;
    });
  }
開發者ID:EscuelaIt,項目名稱:class8-ionic-2,代碼行數:13,代碼來源:home.ts

示例5: selectFromGallery

 selectFromGallery() {
   var options = {
     sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
     destinationType: Camera.DestinationType.FILE_URI
   };
   Camera.getPicture(options).then((imageData) => {
     this.cameraUrl = imageData;
     this.photoSelected = true;
     this.photoTaken = false;
   }, (err) => {
     // Handle error
   });
 }
開發者ID:ivanthecrazy,項目名稱:devfanaticblog-camera-upload,代碼行數:13,代碼來源:home.ts

示例6: takePicture

 takePicture(){
   Camera.getPicture({
       destinationType: Camera.DestinationType.DATA_URL,
       targetWidth: 1024,
       targetHeight: 768,
       correctOrientation: false,
       quality: 80
   }).then((imageData) => {
     // imageData is a base64 encoded string
       this.base64Image = "data:image/jpeg;base64," + imageData;
   }, (err) => {
       console.log(err);
   });
 }
開發者ID:RemaxThailand,項目名稱:RemaxMobile,代碼行數:14,代碼來源:payments-confirm.ts

示例7: getPicture

 getPicture(sourceType){
   let options = {
     destinationType: Camera.DestinationType.DATA_URL,
     targetWidth: 1000,
     targetHeight: 1000,
     quality: 100,
     correctOrientation: true,
     saveToPhotoAlbum: false,
     sourceType: (sourceType == 'picture') ? Camera.PictureSourceType.PHOTOLIBRARY : Camera.PictureSourceType.CAMERA
   }
   Camera.getPicture(options).then((imageData) => {
     this.image = "data:image/jpeg;base64," + imageData;
   }, (err) => {
   });
 }
開發者ID:jorgerrubio,項目名稱:ionic-v2-native,代碼行數:15,代碼來源:camara.ts

示例8: takePicture

 takePicture() {
    Camera.getPicture({
       destinationType: Camera.DestinationType.FILE_URI,
       targetWidth: 1000,
       targetHeight: 1000,
       correctOrientation: true
     }).then((imageURI) => {
     // imageData is a base64 encoded string
       console.log(imageURI);
       this.image.src =  imageURI;
       // this.base64Image = "data:image/jpeg;base64," + imageURI;
     }, (err) => {
       console.log(err);
     });
 }
開發者ID:a-santamaria,項目名稱:cropIonic,代碼行數:15,代碼來源:home-page.ts

示例9: getPicture

 getPicture (sourceType: number) {
   // You can check the values here:
   // https://github.com/driftyco/ionic-native/blob/master/src/plugins/camera.ts
   Camera.getPicture({
     quality: 100,
     destinationType: 0, // DATA_URL
     sourceType: sourceType,
     allowEdit: true,
     saveToPhotoAlbum: false,
     correctOrientation: true
   }).then(imageData => {
     this.srcImage = `data:image/jpeg;base64,${imageData}`;
   }, error => {
       console.log(`ERROR -> ${JSON.stringify(error)}`);
   });
 }
開發者ID:Dakuan,項目名稱:ionic-ocr-example,代碼行數:16,代碼來源:home.ts

示例10: takePicture

 //add action take a picture
 takePicture() {
   Camera.getPicture({
     destinationType: Camera.DestinationType.DATA_URL
   })
     .then((image) => {
       //image is a base64 encoded string
       this.base64Image = "data:image/jpeg;base64," + image;
     }, (error) => {
       //display alert if error
       let alert = Alert.create({
         title: 'Ups. Error occurs!',
         subTitle: 'Sorry, we have a error. Please try later or fix the bug.',
         buttons: ['OK']
       });
       this.nav.present(alert);
     });
 }
開發者ID:ol3j,項目名稱:myapp,代碼行數:18,代碼來源:camera.ts


注:本文中的ionic-native.Camera類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。