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


TypeScript Camera.getPicture方法代碼示例

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


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

示例1: takePicture

  takePicture(){
    this.camera.getPicture({
      destinationType: this.camera.DestinationType.DATA_URL,

      targetWidth: 1000,
      targetHeight: 1000
    }).then((ImageData) =>{
      this.base64Image = "data:image/jpeg;base64," + ImageData;
    }, (err) => {
      console.log(err);
    });
  }
開發者ID:Jeffsummers2412,項目名稱:camera,代碼行數:12,代碼來源:camera.ts

示例2: getImage

 getImage() {
   const options: CameraOptions = {
     quality: 100,
     destinationType: this.camera.DestinationType.FILE_URI,
     sourceType: this.camera.PictureSourceType.PHOTOLIBRARY
   }
 
   this.camera.getPicture(options).then((imageData) => {
     this.imageURI = imageData;
   }, (err) => {
     console.log(err);
     this.presentToast(err);
   });
 }
開發者ID:tinchoas19,項目名稱:app-upload-camera,代碼行數:14,代碼來源:home.ts

示例3: takePhoto

  async takePhoto() {
    try {
      const imageData = await this.camera.getPicture({
        quality: 100,
        destinationType: this.camera.DestinationType.FILE_URI,
        sourceType: this.camera.PictureSourceType.CAMERA,
        encodingType: this.camera.EncodingType.PNG
      });

      await this.uploadPhoto(imageData);
    }
    catch (e) {
      console.log(e);
    }
  }
開發者ID:ralscha,項目名稱:attic,代碼行數:15,代碼來源:home.ts

示例4: takePicture

takePicture(){
    this.camera.getPicture({
        destinationType: this.camera.DestinationType.DATA_URL,
        targetWidth: 1000,
        targetHeight: 1000
    }).then((imageData) => {
      // imageData is a base64 encoded string
        this.base64Image = "data:image/jpeg;base64," + imageData;
        this.base64NoGarbase = imageData;
        this.uploadImage();
        //console.dir("base 64 image: "+this.base64NoGarbase);
    }, (err) => {
        console.log(err);
    });
  }
開發者ID:jessiejane,項目名稱:SimpleLiving,代碼行數:15,代碼來源:billsplitter.ts

示例5: takePhoto

  takePhoto(){
    const options: CameraOptions = {
      quality: 100,
      destinationType: this.camera.DestinationType.DATA_URL,
      encodingType: this.camera.EncodingType.JPEG,
      mediaType: this.camera.MediaType.PICTURE
    };

    this.camera.getPicture(options).then((imageData) => {
      this.photo = 'data:image/jpeg;base64,' + imageData;
      return this.photo;
    }, (err) => {
      this.showErrorMessage();
    });
  };
開發者ID:50Hannah000,項目名稱:MDB1,代碼行數:15,代碼來源:camera.ts

示例6: selectPhoto

  async selectPhoto() {
    try {
      const imageData = await
        this.camera.getPicture({
          sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
          destinationType: this.camera.DestinationType.FILE_URI,
          quality: 100,
          encodingType: this.camera.EncodingType.PNG,
        });

      await this.uploadPhoto(imageData);
    }
    catch (e) {
      console.log(e);
    }
  }
開發者ID:ralscha,項目名稱:attic,代碼行數:16,代碼來源:home.ts

示例7: takePhoto

  takePhoto(){
    const options: CameraOptions = {
      quality: 100,
      destinationType: this.camera.DestinationType.DATA_URL,
      encodingType: this.camera.EncodingType.JPEG,
      mediaType: this.camera.MediaType.PICTURE
    };

    this.camera.getPicture(options).then((imageData) => {
      // imageData is either a base64 encoded string or a file URI
      // If it's base64:
      this.base64Image = 'data:image/jpeg;base64,' + imageData;
     }, (err) => {
      this.showErrorMessage();
         });
    };
開發者ID:50Hannah000,項目名稱:MDB1,代碼行數:16,代碼來源:picture.ts

示例8: chamarCamera

  chamarCamera(){
    debugger
    const options: CameraOptions = {
      quality: 100,
      destinationType: this.camera.DestinationType.FILE_URI,
      encodingType: this.camera.EncodingType.JPEG,
      mediaType: this.camera.MediaType.PICTURE
    }
    this.camera.getPicture(options).then((imageData) => {
      // imageData is either a base64 encoded string or a file URI
      // If it's base64 (DATA_URL):
      let base64Image = 'data:image/jpeg;base64,' + imageData;
     }, (err) => {
      // Handle error
     });
    

  }
開發者ID:flaviacriss,項目名稱:Verdejarapp,代碼行數:18,代碼來源:newtree.ts

示例9: resolve

 return new Promise<Array<string>>((resolve, reject) => {
   let options: any =
 	{
 		quality: 100,
 		correctOrientation: true,
     destinationType: 1,
 	};
 	this.cameraService.getPicture(options).then((data: string) => {
     this.saveImages(new Array<string>(data), true, this.fileService.getAppStoragePath()).then((resultPhotos: Array<string>) =>{
       resolve(resultPhotos);
     }).catch(error => {
       console.log('Error during photo reduce: ' + error.message);
     });
 	}, error =>	{
     console.log('Error during taking photo: ' + error.message);
     resolve(new Array<string>());
   });
 });
開發者ID:exodinn,項目名稱:StarterKit,代碼行數:18,代碼來源:image-service.ts

示例10: takePicture

  takePicture(){
    let options = {
      quality: 100,
      correctOrientation: true
    };

    this.camera.getPicture(options)
    .then((data) => {
      this.photos = new Array<string>();
      this.cropService
      .crop(data, {quality: 75})
      .then((newImage) => {
        this.photos.push(newImage);
      }, error => console.error("Error cropping image", error));
    }, function(error) {
      console.log(error);
    });
  }
開發者ID:zglnfsdyy,項目名稱:ionic3-image-handling,代碼行數:18,代碼來源:home.ts


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