使用Phonegap将CameraRoll图像绘制到画布

问题描述:

我正在尝试(又发疯)从相机胶卷/相册的iPhone中获取图像,并通过phonegap放在画布上,特别是使用相机插件",但我做不到.这是应该在标签中显示图像的函数,但是由于要编辑然后将其放置在画布中,然后将其保存:

I'm trying (aka getting mad) to get an image from camera roll/album's iphone and putting onto a canvas over phonegap, and specifically, using the Camera Plugin but I can't do it. Here is the function that should show the image in an tag, but I want to put it in canvas due to edit and then save it:

function onPhotoURISuccess(imageURI) {
      var largeImage = document.getElementById('largeImage');
      largeImage.style.display = 'block';
      largeImage.src = imageURI;
}

有什么想法吗?

预先感谢, DGM.-

Thanks in advance, DGM.-

这是解决方案:)

function onPhotoURISuccess(imageURI) {
    var cambas = document.getElementById('canvas_1');
    var ctx = cambas.getContext("2d");
    var imagen = new Image();
    imagen.onload = function(){
        cambas.width = imagen.width;
        cambas.height = imagen.height;
        ctx.drawImage(imagen, 0, 0, imagen.width, imagen.height);
    }

    imagen.src = imageURI;
}