cordovaCamera ionic V1

  1.  install plugin
    • # cordova plugin add cordova-plugin-camera
  2. Code Control
    1. module.controller('PictureCtrl', function($scope, $cordovaCamera) {
      
        document.addEventListener("deviceready", function () {
      
          var options = {
            quality: 50,
            destinationType: Camera.DestinationType.DATA_URL,
            sourceType: Camera.PictureSourceType.CAMERA,
            allowEdit: true,
            encodingType: Camera.EncodingType.JPEG,
            targetWidth: 100,
            targetHeight: 100,
            popoverOptions: CameraPopoverOptions,
            saveToPhotoAlbum: false,
      	  correctOrientation:true
          };
      
          $cordovaCamera.getPicture(options).then(function(imageData) {
            var image = document.getElementById('myImage');
            image.src = "data:image/jpeg;base64," + imageData;
          }, function(err) {
            // error
          });
      
        }, false);
      });
Share

admin

ประวัติการศึกษา ระดับปริญญาตรี : วิศวกรรมโทรคมนาคม คณะวิศวกรรมศาสตร์ พระจอมเกล้าเจ้าคุณทหารลาดกระบัง ระดับปริญญาโท : วิศวกรรมคอมพิวเตอร์ คณะวิศวกรรมศาสตร์ มหาวิทยาลัยสงขลานครินท์ หาดใหญ่

You may also like...

ใส่ความเห็น