From 67d1be05566ba766b2408bac62e31dc711399f0b Mon Sep 17 00:00:00 2001 From: Isaiah Odhner Date: Wed, 23 Oct 2013 22:11:00 -0400 Subject: [PATCH] Canvas to draggable image --- src/jquery.qrcode.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/jquery.qrcode.js b/src/jquery.qrcode.js index da44e0e..6971c55 100644 --- a/src/jquery.qrcode.js +++ b/src/jquery.qrcode.js @@ -42,8 +42,14 @@ ctx.fillRect(Math.round(col*tileW),Math.round(row*tileH), w, h); } } - // return just built canvas - return canvas; + + // make an image from the canvas + var img = document.createElement('img'); + img.src = canvas.toDataURL('image/png'); + img.width = options.width; + img.height = options.height; + // return just built img + return img; } // from Jon-Carlos Rivera (https://github.com/imbcmdth)