magem HTML @ Canvas no problema Base64
Estou tendo um problema ao recuperar a versão base64 de uma imagem exibida em uma tela. Examinei as outras perguntas, mas nenhuma das soluções, incluindo canvas2image, parece funciona
Aqui está o meu código:
<!DOCTYPE>
<html>
<head>
<style>#canvas {cursor: pointer;}</style>
</head>
<body>
<canvas id="canvas"></canvas>
<script type="text/javascript">
var can = document.getElementById('canvas');
var ctx = can.getContext('2d');
var img = new Image();
img.onload = function(){
can.width = img.width;
can.height = img.height;
ctx.drawImage(img, 0, 0, img.width, img.height);
}
img.src = 'http://sstatic.net/stackoverflow/img/newsletter-ad.png';
can.onclick = function() {
ctx.translate(img.width-1, img.height-1);
ctx.rotate(Math.PI);
ctx.drawImage(img, 0, 0, img.width, img.height);
};
document.write(can.toDataURL()); //isn't writing the correct base64 image
</script>
</body>
</html>
Aqui está o link do teste:http: //jsfiddle.net/mrchief/hgTdM/1 obrigado, Mrchief
O que eu preciso é a saída base64 correta da imagem na tel
O problema é que ela não produzirá a versão base64 correta da imagem .. Mas, como você pode ver, a imagem dentro da tela é exibida sem problema
Eu testei no chrome & firefox
Muito obrigado ..