Skip to content

Commit cd62d7b

Browse files
author
sam.bell
committed
Added additional QR code per attendee for VCard
1 parent 4939e10 commit cd62d7b

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

bin/badges.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@
7070
'ticket' => $ticketName,
7171
'period' => $ticketPeriod,
7272
'barcode' => $barcode,
73-
'qre' => $barcode . '.png',
73+
'qre' => $attendee->id . '_number.png',
74+
'vcard' => $attendee->id . '_vcard.png',
7475
);
7576
}
7677

bin/qr.php

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
chdir(__DIR__ . '/../');
44

5+
use JeroenDesloovere\VCard\VCard;
56
require('vendor/autoload.php');
67
$config = require('config/local.php');
78

@@ -36,9 +37,27 @@
3637
$barcode = $barcodeObject->barcode->id;
3738
}
3839

39-
$filename = __DIR__ . '/../qr/' . $attendee->id . '.png';
40-
echo 'Generating QR for ' . $attendee->id . ' ' . $barcode . PHP_EOL;
41-
\PHPQRCode\QRcode::png($barcode, $filename, 'L', 30, 4);
40+
// define vcard
41+
$vcard = new VCard();
42+
43+
// add personal data
44+
$vcard->addName($attendee->last_name, $attendee->first_name);
45+
46+
// add work data
47+
$vcard->addCompany($attendee->company);
48+
$vcard->addJobtitle($attendee->job_title);
49+
$vcard->addEmail($attendee->email);
50+
$vcard->addPhoneNumber($attendee->work_phone, 'PREF;WORK');
51+
$vcard->addPhoneNumber($attendee->work_phone, 'WORK');
52+
$vcard->addURL($attendee->website);
53+
54+
$numberFilename = __DIR__ . '/../qr/' . $attendee->id . '_number.png';
55+
echo 'Generating QR number for ' . $attendee->id . ' ' . $barcode . PHP_EOL;
56+
\PHPQRCode\QRcode::png($barcode, $numberFilename, 'L', 30, 4);
57+
58+
$vcardFilename = __DIR__ . '/../qr/' . $attendee->id . '_vcard.png';
59+
echo 'Generating QR vcard for ' . $attendee->id . ' ' . $barcode . PHP_EOL;
60+
\PHPQRCode\QRcode::png($vcard->buildVCard(), $vcardFilename, 'L', 30, 4);
4261
}
4362

4463
ksort($data);

0 commit comments

Comments
 (0)