0
Hello, I’m having a problem turning a div into canvas, because inside this div has an img, and src contains the FULL image url, with http, when it is a normal image that is already on the server I have no problems, it converts quietly, but when src is with http it takes the whole div but the image it does not recognize, I am using html2canvas, follow my code:
HTML:
<div id="mesa" style="width:800px; height:800px; float:left; clear:both;">
<div style="width:800px; height:500px; background:#CCC; float:left;">
<img src="http://i.imgur.com/kOhhPAk.jpg" width="800" height="500">
</div>
<div style="width:800px; height:50px; background:#00F; float:left;">texto</div>
</div>
JAVASCRIPT:
$(document).ready(function(){
html2canvas($("#mesa"), {
onrendered: function(canvas){
var imagem = canvas.toDataURL('image/png');
var image = new Image();
image.src = imagem;
$("body").append(image);
}
});
});
repeating, if the image src is an image of the server (e.g., src="image.jpg") it takes normal, but if it is src="http://outrosite.com.br/imagem.jpg" then it does not take the image, because it happens ? I need to get the image this way, from another site... Is there any solution ?
thank you!
This must be a security error... have you seen the console? Generally your site/domain is not allowed to cross the other site because of settings, even on . htaccess.
– Klaider
So on the console there is no error, and on . htaccess there is nothing blocking tbm :/
– Pablo Schuab
So there’s a few more clues?
– Klaider
I saw something about cross-Omain, about putting crossDomain = "Anonymous", but I don’t know where to put it, I tried to put it in some places, but even so n worked
– Pablo Schuab