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
Read More:
- Chart.js Error: “Canvas is already in use. Chart …must be destroyed before the canvas can be reused”
- [How to Solve] canvas.save(Canvas.ALL_SAVE_FLAG)
- [Solved] Gitee generates public key error: Enter file in which to save the key…
- IDEA generates Spring Boot project error: error: read timed out
- [Solved] Unity Publish WebGL Error: Unable to parse Build/webTest2.framework.js.gz
- error: (-215:Assertion failed) size.width>0 && size.height>0 in function ‘cv::imshow‘
- [Solved] Labelimg Open an image Error: Error opening file
- openlayers — Cannot read property ‘slice‘ of null—Map cannot be loaded
- [Solved] Mac Notebook M1 Chip Install Hashlips library npm error
- [Solved] Eval Error: Uncaught ReferenceError: False is not defined
- [Go] Solve the garbled content sent by go-smtp and the unparsed html mail sent
- Solution to latex “too many unprocessed floats” error
- Java handles special characters in URL
- Download and save uniapp pictures to Android error reporting app
- [Solved] Tensorflow-gpu Error: self._traceback = tf_stack.extract_stack()
- [Solved] mmdetection yolox Error: find_unused_parameters
- [Solved] Keil C Error: error C141: syntax error near ‘=‘, expected ‘__asm‘
- [Solved] error converting to execution character set illegal byte sequence
- VSCode Terminal Execute tsc Commands Error [Solved]
- [Vue warn]: Error in render: TypeError: Cannot read property ‘xxxx’of undefined