Buy Now
Sign in

Qr code on CV6

currucutaco , October 20 2017
C
currucutaco
Hi I have a doubt, There is the possibility of using the phpqrcode library to insert a code qr in my form?

I have used this on Chronoforms v5 but not in Chronoforms v6 the code is not generated
-This is the code that I use (before I download the phpqrcode library from web and insert the file phpqrcode.php in the folder)

<?php
// get the QR Code library
include (JPATH_SITE.'/components/com_chronoforms6/extras/phpqrcode/phpqrcode.php');

// this line sets the content of the qr code
$text = $form->data['folio'];

$folder = JPATH_SITE.'/components/com_chronoforms6/uploads/qrcodes/';
$url = JURI::root().'components/com_chronoforms6/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>";
?>
Attachments
Screen_Shot_2017-10-19_at_8.21.55_PM.png
Screen_Shot_2017-10-19_at_8.21.55_PM.png
(157.47 KiB)
51 Downloads/Views
Screen_Shot_2017-10-19_at_8.22.21_PM.png
Screen_Shot_2017-10-19_at_8.22.21_PM.png
(289.47 KiB)
50 Downloads/Views
Screen_Shot_2017-10-19_at_8.23.03_PM.png
Screen_Shot_2017-10-19_at_8.23.03_PM.png
(154.87 KiB)
66 Downloads/Views
Screen_Shot_2017-10-19_at_8.24.02_PM.png
Screen_Shot_2017-10-19_at_8.24.02_PM.png
(54.35 KiB)
53 Downloads/Views
GreyHead
Hi currucutaco,

CFv6 has a different way of handling PHP variables - it does not use $form->data (and maybe not $form->files). Please check the manual for the way to create dynamic values like this.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much