WeChat official account H5 page, creating the idea of two-dimensional code posters with parameters.
1. Generate QR code with parameters
use the plug-in phpqrcode, which has been recorded in previous articles. No more details.
2. Generate canvas canvas
draw the poster content through cavans first. Then convert the canvas picture to Base64 encoding using todataurl. Then, copy the base64 encoding to the picture and display it.
var canvas = document.getElementById("myCanvas");
var imgBase64=canvas.toDataURL("image/png");
var oimg = document.getElementById("img");
oimg.src=imgBase64;
3. The displayed pictures can be stored by long-pressing save
note: all elements in the canvas need to be loaded, otherwise an error will be reported in todataurl
therefore, crossorigin = “anonymous” should be added to the attributes of all pictures or documents