Kirby CMS Panel Field and Page-Method rendering a QR Code.
Usage
Field
Add a kirby panel field to your blueprint to show a qrcode of the kirby $page->url() within the panel. This plugin uses a global field definition to cut some corners.
Default paramters of QR code lib will be used to render the image or the parameters set in your config.php.
#fieldname: fieldtype
qrcode: qrcode
Page Method
The plugin also adds a $page->qrcode() function which returns an image as Media object to use in templates etc.
You can use the default values, override them or set your own parameters on-the-fly using an associative array. Missing parameters will fallback to defaults of lib.
// DEFAULTS
$qrcodeDefault = $page->qrcode(); // Kirby Toolkit Media Object
// CUSTOM
$allCustomParameters = [
'Text' => $page->url(), // plugin default
'Size' => 300,
'Padding' => 10,
'ErrorCorrection' => 'high',
'ForegroundColor' => ['r' => 0, 'g' => 0, 'b' => 255, 'a' => 0],
'BackgroundColor' => ['r' => 255, 'g' => 255, 'b' => 255, 'a' =>0],
'Label' => 'You take the blue pill',
'LabelFontSize' => 16,
'ImageType' => Endroid\QrCode\QrCode::IMAGE_TYPE_PNG, // lib default
'Filename' => $page->slug().'-qrcode', // plugin default
];
// override defaults. this can be done in config.php as well.
c::set('plugin.qrcode', $allCustomParameters);
$qrcodeCustom = $page->qrcode(); // using new defaults now
// or use them on-the-fly
$qrcodeCustom = $page->qrcode([
'Label' => 'You take the red pill',
'ForegroundColor' => ['r' => 255, 'g' => 0, 'b' => 0, 'a' => 0],
'ImageType' => Endroid\QrCode\QrCode::IMAGE_TYPE_JPEG,
]);
// then use media object to get brick and echo the image
// https://github.com/getkirby/toolkit/blob/master/lib/media.php#L539
echo $qrcodeCustom->html();
A visitor is a visitor (in German: “Besucher”) e.g. in a company, who wants to have the homepage link of the company at his/her mobile.
The screen with the QR is owned by the company and e.g. in front of a wall in the public parts of that building.
Or on a German website: https://www.sav-barchfeld.de/ueber-die-website/kontakt
You can actually stuff quite a bit of stuff into a QR code, not just a page link. Depends what you want to share with it. But, generally your right… QR codes are best used in printed matter.
i use with a non-public booking plugin i created. pdf invoices based on html layout (using mpdf) including the qr-code image are send to customers per email (and online version). the qrcode can be a link with token to make it more secure.
at the event the ticket can quickly be verified by the staff with just a regular mobile phone - scanning the qrcode from customers mobile screen.
I would like to use QR-Codes to provide a simple delivery of event-cards…
Also vCards are an interesting usecase…
there are several people who discover a website via laptop/desktop… and just pulling out smartphone to scan a qr-code.
loading the website again via smartphone-browser… and then click on a link to download a file… is not the shortest workflow… thx for this plugin… will test it in near future. is it still working? i’m asking, because https://endroid.nl/ is not realy usefull right now =)
@bnomei I have a question about this, as I have a very similar scenario in my current project. I would like to send the customers the qr-code image via email, but not as part of a PDF, just a png of the QR-code itself.
Using your plugin, can I somehow – in a page creation hook – create a QR code that is saved as a file to the newly created page? Or is there another way to attach the QR code to an email?