ProgrammerAH

Programmer Guide, Tips and Tutorial

Skip to content

Canvas generates poster todataurl with error [Solved]

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

This entry was posted in Error and tagged es6, front end, javascript, Official account development on 2021-11-23 by Robins.

Post navigation

← Cocoapods Upgrade Error: ffi * * * * [How to Solve] Python server run code ModuleNotFoundError Error [How to Solve] →

Recent Posts

  • MAFIA: 1- OpenFlow statistics (Counters, Timestamps)(mafia-sdn/p4demos/demos/1-openflow/1.1-statistics/p4src/of.p4)
  • LDSC: Could not open Corces_ATAC_1000Gv3_ldscores/Corces_ATAC.1.1.l2.ldscore[./gz/bz2]
  • Gradle Package Project Lombok Not Working: No serializer found for class com.qbb.User and no properties discovered to create BeanSerializer……
  • [Solved] PCH Warning: header stop not at file scope
  • pymysql Error: File “/usr/local/lib/python2.7/site-packages/PyMySQL-1.0.2-py2.7.egg/pymysql/connections.py”, line 167 SyntaxError: invalid syntax
Proudly powered by WordPress