html2canvas не захватывает внешнее изображение в div - PullRequest
1 голос
/ 15 апреля 2019

html2canvas не захватывает внешнее изображение внутри div. Я нашел где-то, что allowTaint: true может решить проблему. но все еще получаю пустое изображение. пожалуйста, помогите

$(document).ready(function() {

$("#capture").click(function(){

html2canvas($('#preview-container').get(0),{ allowTaint: true }).then( function (canvas) {
  // console.log(canvas.toDataURL());
 dataURL= canvas.toDataURL('image/jpeg', 0.9).split(',')[1];

    $.ajax({
    url: 'https://api.imgur.com/3/image',
    type: 'post',
    headers: {
        Authorization: 'Client-ID ***********'
    },
    data: {
        image: dataURL
    },
    dataType: 'json',
    error:function(response){

    console.log(response);

    },
    success: function(response) {
        if(response.success) {
            alert(response.data.link);
            window.location = response.data.link;

        }
    }
});
 });

 });
 });
...