Guest User

Untitled

a guest
Dec 13th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. import { Component } from "@angular/core";
  2. import { Camera, CameraOptions } from "@ionic-native/camera";
  3.  
  4. @Component({
  5. selector: "page-camera",
  6. templateUrl: "camera.html"
  7. })
  8. export class CameraPage {
  9. public base64Image: string;
  10.  
  11. constructor(public camera: Camera) {}
  12.  
  13. takePicture() {
  14. this.camera
  15. .getPicture({
  16. destinationType: this.camera.DestinationType.DATA_URL,
  17. targetWidth: 1000,
  18. targetHeight: 1000
  19. })
  20. .then(
  21. imageData => {
  22. // imageData is a base64 encoded string
  23. this.base64Image = "data:image/jpeg;base64," + imageData;
  24. },
  25. err => {
  26. console.log(err);
  27. }
  28. );
  29. }
  30. }
  31.  
  32. 2018-12-13 11:31:24.183490-0500 MyApp[3844:312133] ERROR: Plugin 'Camera' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
  33. 2018-12-13 11:31:24.183546-0500 MyApp[3844:312133] -[CDVCommandQueue executePending] [Line 142] FAILED pluginJSON = ["Camera1764610053","Camera","takePicture",[50,0,1,1000,1000,0,0,false,false,false,null,0]]
Add Comment
Please, Sign In to add comment