I’m trying to load an image from the camera into a new images and pass into the kineticjs object but the image wont load. Can anyone suggest where I am going wrong please.
function onPhotoDataSuccess(imageData) {
var returnedImg = new Image();
returnedImg.src = "data:image/jpeg;base64," + imageData;
layer.clear();
returnedImg.onload = function() {
console.log('img loaded');
mainImage = new Kinetic.Image({
image: returnedImg,
x: stage.getWidth() / 2 - 200 / 2,
y: stage.getHeight() / 2 - 137 / 2,
draggable: true,
startScale: 1
});
layer.add(mainImage);
stage.add(layer);
};
}
Any help much appreciated.
regards
Move this line
returnedImg.src = “data:image/jpeg;base64,” + imageData;
below the onload