问题
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;
}
Any ideas?
Thanks in advance, DGM.-
回答1:
And this is the solution : )
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;
}
来源:https://stackoverflow.com/questions/9893741/cameraroll-image-to-canvas-using-phonegap