JSFiddle - React, Tailwind, and code Playground
HTML
<canvas id="canvas"></canvas>
JavaScript
var app = new FotoPrint();
function FotoPrint() {
this.init = function() {
this.im = new Image();
var that = this;
this.im.onload = function () {
that.canvas = document.getElementById('canvas');
that.ctx = that.canvas.getContext("2d");
that.ctx.clearRect(0, 0, that.canvas.width, that.canvas.height);
that.ctx.strokeStyle = "black";
that.ctx.lineWidth = 2;
that.ctx.strokeRect(0, 0, that.canvas.width, that.canvas.height);
that.ctx.drawImage(that.im,0,0);
};
this.im.src = "https://lh3.googleusercontent.com/-_HBY6uNKDkQ/AAAAAAAAAAI/AAAAAAAAABU/xE48kRJgvuw/photo.jpg?sz=32";
};
};
app.init();