This FAQ describes how to use form data to create a QR code that can be shown on your site or attached to an email.
To create the code we need a custom PHP library installed on the site. I used a version of the PHP QRcode generator library available here on GitHub. When you have down-loaded the library, unzip the file and copy the phpqrcode.php file and the cache folder to a new /components/com_chronoforms5/extras/phpqrcode/ folder on your site.
In your form On Submit event add a Custom Code action with code like this:
<?php // get the QR Code library include (JPATH_SITE.'/components/com_chronoforms5/extras/phpqrcode/phpqrcode.php'); // this line sets the content of the qr code $text = $form->data['text1']; $folder = JPATH_SITE.'/components/com_chronoforms5/uploads/qrcodes/'; $url = JURI::root().'components/com_chronoforms5/uploads/qrcodes/'; // create the file name $file_name = 'qr_'.date('Ymd-his').'.png'; // create the QR code QRcode::png($text, $folder.$file_name); // save the name to the $form->data array $form->data['qr_code'] = $file_name; // add the file info to the $form->files array $form->files['qr_code'] = array( 'name' => $file_name, 'link' => $url.$file_name, 'path' => $folder.$file_name, 'size' => filesize($folder.$file_name) ); // display the code echo "<div><img src='{$url}{$file_name}' /></div>"; ?>
Change the code to set the data to be encode and to create the file name to meet your form needs.
Save and test.
This code saves the created png file and shows it in the thank you page of the form. You can add qr_code to the Attachments box of an Email to attach the file there.