xhay
xhay

Reputation: 11

Canva drawImage not working in chrome use this image

  1. use chrooe
  2. open devtools
  3. open this page

https://codesandbox.io/s/fervent-benz-44qsh2?file=/index.html

only this imgae can't render in chrome.

const canvas = document.getElementById("myCanvas");
        const img1 = new Image();
        img1.width = 100;
        img1.height = 100;

        // img1.referrerPolicy = 'no-referrer';

        img1.onload = (res) => {

          const ctx = canvas.getContext("2d");

          ctx.font = "48px serif";
          ctx.fillText("Hello world", 10, 50);
          ctx.drawImage(img1, 0, 0, 81.3, 128);

          document.body.appendChild(img1);
        };

        img1.src = 'img'
}

Upvotes: 1

Views: 47

Answers (0)

Related Questions