This plugin generates QR Code in TWiki pages. A QR Code is a specific matrix barcode (or two-dimensional code), readable by dedicated QR barcode readers and camera phones. The code consists of black modules arranged in a square pattern on a white background. The information encoded can be any text, such as phone numbers, URLs, gelocation, vCard, vCal and more.
%QRCODE{ "text" ... }%
Parameter | Description | Default |
---|---|---|
"text" |
Text to encode as 2D barcode. | (required) |
ecc="M" |
Error Correction Capability. Valid values "L" , "M" , "Q" , "H" . |
"M" |
version="..." |
Symbol version of QR Code, or size of matrix. Valid values "1" ... "40" , and "auto" for automatic versioning. See details below. |
"8" |
size="..." |
Module size, e.g. pixel size of a block (bit) that makes up the matrix of the barcode. | "4" |
format="..." |
Format of HTML img tag of generated QR Code image. Supported variables: $urlpath - URL path of image, $width - image width, $height - image height. |
"<img src='$urlpath' width='$width' height='$height' border='0' alt='' />" |
QR Code has error correction capability (ECC) to restore data if the code is dirty or damaged:
"L"
- about 7%
"M"
- about 15%
"Q"
- about 25%
"H"
- about 30%
The length of text (number of bytes) and the ECC determine the symbol version (e.g. matrix size) required to encode some text. A version="auto"
selects the version automatically based on text length and ECC. See "Attention" note in the "Plugin Installation & Configuration" section below before using "auto"
.
Overview of symbol version for default ECC level
"M"
:
|
|
|
|
The size of the generated image depends on the symbol version and the module size. For example, version="2"
and size="3"
results in a 99x99 pixels image. Version 2 has matrix size 25x25. A module size 3 turns that into 3 times 25x25 pixels, or 75x75 pixels. There is some required whitespace, which results in a 99x99 pixels image size.
See also VarQRCODE documentation for TWikiVariables.
http://twiki.org/
You type | You get (if installed) | Simulated example |
---|---|---|
%QRCODE{ "http://twiki.org/" version="2" size="3" }% | QRCode Plugin Error: Can't locate object method "new" via package "GD::Image" (perhaps you forgot to load "GD::Image"?) at /usr/local/share/perl5/GD/Barcode/QRcode.pm line 304. |
![]() |
The QR Code of the current topic can be placed in a TWiki skin so that the URL can easily be read by smart phones. We use symbol version 8, e.g. the URL cannot be longer than 152 characters.
You type | You get (if installed) | Simulated example |
---|---|---|
%QRCODE{ "%SCRIPTURL{view}%/%WEB%/%TOPIC%" version="8" size="4" }% | QRCode Plugin Error: Can't locate object method "new" via package "GD::Image" (perhaps you forgot to load "GD::Image"?) at /usr/local/share/perl5/GD/Barcode/QRcode.pm line 304. |
![]() |
You can add a QR Code pulldown to the TopMenuSkin so that smartphone users can easily bookmark any TWiki page. Add the following to your TopMenuSkinTopicMenu after the Edit pulldown bullets:
You type | You get (if installed) | Simulated example |
---|---|---|
* [[%BASEWEB%.%BASETOPIC%][<img src="%PUBURLPATH%/%SYSTEMWEB%/QRCodePlugin/ qrcode.gif" alt="" width="16" height="16" /> %ICON{menu-down}%]] * [[%SYSTEMWEB%.QRCodePlugin][%QRCODE{ "%SCRIPTURL{view}%/%BASEWEB%/%BASETOPIC%" version="auto" size="4" }%]] |
![]() |
You can encode any text with this interactive form. The matrix size is set automatically using version="auto"
.
You type | You get (if installed) | Simulated example |
---|---|---|
<form action="%SCRIPTURL{view}%/%WEB%/%TOPIC%#QrForm"> <input type="text" name="qrcode" value="%URLPARAM{ "qrcode" encode="entity" default="Enter text" }%" size="20" class="twikiInputField" /><br />s <input type="submit" value="Generate QR Code" class="twikiSubmit" /> </form> %QRCODE{ "%URLPARAM{ "qrcode" encode="quote" default="Enter text" }%" version="auto" }% |
QRCode Plugin Error: Can't locate object method "new" via package "GD::Image" (perhaps you forgot to load "GD::Image"?) at /usr/local/share/perl5/GD/Barcode/QRcode.pm line 304. |
|
Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the TWiki server.
QRCodePlugin.zip
in your twiki installation directory. Content: File: | Description: |
---|---|
data/TWiki/QRCodePlugin.txt | Plugin topic |
data/TWiki/VarQRCODE.txt | QRCODE variable documentation topic |
lib/TWiki/Plugins/QRCodePlugin.pm | Plugin Perl module |
lib/TWiki/Plugins/QRCodePlugin/Core.pm | Plugin core module |
pub/TWiki/QRCodePlugin/twiki-logo-80x40-t.gif | Logo file |
pub/TWiki/QRCodePlugin/qrcode-example-*.png | Example QR Code image files |
Attention, CPAN:GD::Barcode::QRcode
version 1.15 needs to be patched as follows before you can use
version="auto"
:
--- /usr/lib/perl5/site_perl/5.8.0/GD/Barcode/QRcode.pm.save1 2004-04-23 23:35:34.000000000 -0700 +++ /usr/lib/perl5/site_perl/5.8.0/GD/Barcode/QRcode.pm 2011-02-11 22:37:13.000000000 -0800 @@ -37,7 +37,7 @@ $oSelf->{text} = $sTxt; $oSelf->{Ecc} = $rhPrm->{Ecc} || ' '; $oSelf->{Ecc} =~ tr/LMHQ/M/c; #Not /LMQH/ => M - $oSelf->{Version} = $rhPrm->{Version} || 1; + $oSelf->{Version} = $rhPrm->{Version} || 0; $oSelf->{ModuleSize} = $rhPrm->{ModuleSize} || 1; $oSelf->{ModuleSize} = int($oSelf->{ModuleSize});
Plugin Author: | TWiki:Main.PeterThoeny![]() |
Copyright: | © 2011-2018 TWiki:Main.PeterThoeny![]() ![]() © 2011-2018 TWiki:TWiki.TWikiContributor ![]() |
License: | GPL (GNU General Public License![]() |
Plugin Version: | 2018-07-07 |
Change History: | |
2018-07-17: | TWikibug:Item7852![]() ![]() |
2012-11-14: | TWikibug:Item7020![]() ![]() |
2012-09-03: | TWikibug:Item6837![]() |
2011-07-12: | TWikibug:Item6725![]() |
2011-02-15: | TWikibug:Item6647![]() |
2011-02-13: | TWikibug:Item6647![]() |
2011-02-12: | TWikibug:Item6647![]() |
2011-02-11: | TWikibug:Item6647![]() |
2011-02-09: | TWikibug:Item6647![]() |
TWiki Dependency: | $TWiki::Plugins::VERSION 1.1 |
CPAN Dependencies: | CPAN:GD![]() ![]() ![]() ![]() |
Other Dependencies: | gd (see http://www.libgd.org/![]() |
Perl Version: | 5.005 |
TWiki:Plugins.Benchmark![]() |
GoodStyle nn%, FormattedSearch nn%, QRCodePlugin nn% |
Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/QRCodePlugin![]() |
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/QRCodePluginDev![]() |
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/QRCodePluginAppraisal![]() |
Related Topics: VarQRCODE, TWikiPlugins, DeveloperDocumentationCategory, AdminDocumentationCategory, TWikiPreferences
I | Attachment | History | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|---|
![]() |
qrcode-example-1.png | r1 | manage | 0.3 K | 2018-07-18 - 05:27 | TWikiAdminUser | Saved by install script |
![]() |
qrcode-example-2.png | r1 | manage | 0.7 K | 2018-07-18 - 05:27 | TWikiAdminUser | Saved by install script |
![]() |
qrcode-example-3.png | r1 | manage | 0.2 K | 2018-07-18 - 05:27 | TWikiAdminUser | Saved by install script |
![]() |
qrcode-example-4.png | r1 | manage | 5.9 K | 2018-07-18 - 05:27 | TWikiAdminUser | Saved by install script |
![]() |
qrcode.gif | r1 | manage | 0.1 K | 2018-07-18 - 05:27 | TWikiAdminUser | Saved by install script |