设置相机ios phonegap

时间:2015-03-09 13:41:52

标签: ios cordova canvas camera

我告诉他们我有几个问题。我正在用带有phonegap的插件相机拍照并且适合我,我对该图像所做的是关于将另一张图片放在上面,我正在通过画布进行操作,问题是这是左图像让它看起来。缩放或应用的东西。

原始图片

https://scontent-mia.xx.fbcdn.net/hphotos-xpf1/v/t1.0-9/10987455_403839709795958_6331116352644016645_n.jpg?oh=df8fc2cef2c1255a6babec94b3a2056d&oe=557E3520

画布图片

https://scontent-mia.xx.fbcdn.net/hphotos-xpf1/v/t1.0-9/11064814_403839689795960_2255378534429169909_n.jpg?oh=9c0ebab7c6e9911cc28695fa80cc3033&oe=5581D16B

另外,当我拍照时我不能把它全部拿走,我不明白会有切割图像。

这是设置方法相机和画布。

$scope.guardarFoto = function(){
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
var img = document.getElementById("img_foto");
var img2 = document.getElementById("img_foto2");
ctx.drawImage(img,0,0);
ctx.drawImage(img2,0,0);
window.canvas2ImagePlugin.saveImageDataToLibrary(
    function(msg){
        console.log(msg);
    },
    function(err){
        console.log(err);
    },
    document.getElementById('myCanvas')
   );
  }


 Camera.DestinationType = {
DATA_URL : 0,      // Return image as base64-encoded string
FILE_URI : 1,      // Return image file URI
NATIVE_URI : 2     // Return image native URI (e.g., assets-library:// on iOS or content:// on Android)
 };

 Camera.PictureSourceType = {
PHOTOLIBRARY : 0,
CAMERA : 1,
SAVEDPHOTOALBUM : 2
 };

 Camera.EncodingType = {
JPEG : 0,               // Return JPEG encoded image
PNG : 1                 // Return PNG encoded image
 };

 Camera.MediaType = {
PICTURE: 0,    // allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType
VIDEO: 1,      // allow selection of video only, WILL ALWAYS RETURN FILE_URI
ALLMEDIA : 2 
 };

 Camera.Direction = {
BACK : 0,      // Use the back-facing camera
FRONT : 1      // Use the front-facing camera
 };

 $scope.getPhoto = function() {
var options = {
  quality: 100,
  destinationType: Camera.DestinationType.FILE_URI,
  sourceType: Camera.PictureSourceType.CAMERA,
  allowEdit: true,
  encodingType: Camera.EncodingType.JPEG,
  targetWidth: 500,
  targetHeight: 500,
  popoverOptions: CameraPopoverOptions,
  saveToPhotoAlbum: true,
  correctOrientation: true
};

Camera.getPicture(options).then(function(imageURI) {
  console.log(imageURI);
  $scope.lastPhoto = imageURI;
}, function(err) {
  // error
  });
};

0 个答案:

没有答案