1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-26 10:00:34 +00:00
TiddlyWiki5/plugins/tiddlywiki/qrcode/docs/makeqr.tid
2024-10-09 12:11:44 +01:00

49 lines
1.5 KiB
Plaintext

title: $:/plugins/tiddlywiki/qrcode/docs/qrcode
tags: $:/tags/QRCodeDocs
caption: makeqr Macro
The ''makeqr'' [[macro|Macros]] converts text data into an image of the corresponding QR code. The image is returned as [[base64-encoded data URI|https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs]].
!! Parameters
;text
: The text to encode
;size
: The size of the image in pixels (defaults to 500)
;errorCorrectLevel
: Determines the amount of error correction applied to the image (see below, defaults to "M")
;fallback
: The fallback image to be returned in case of an error (see below)
The conversion will fail if the text is too long and/or complex and the macro will return the provided fallback image. If no fallback image is provided then an error image is generated.
The error correction level is a [[QR code feature|http://www.qrcode.com/en/about/error_correction.html]]:
|errorCorrectLevel |Redundancy |Use cases |h
|L | 7%|Clean environment, large amount of data |
|M | 15%|Default value, most common choice |
|Q | 25%|Dirty environment, small amount of data |
|H | 30%|~|
!! Examples
Making a QR code data URI for a simple string of text:
```
<<makeqr "Hello there!">>
```
Displaying a QR code for a simple string of text:
```
<img src=<<makeqr "Hello there!">> />
```
Displaying a QR code for a transcluded value (URL of the current wiki):
```
\define qr(content) <img src=<<makeqr text:"""$content$""">> />
<$transclude $variable="qr" content={{$:/info/url/full}} />
```