Contacts: Fix QR code.

This commit is contained in:
Nate 2019-09-10 12:08:54 -06:00
parent e73d84118c
commit 86ac504ee0
1 changed files with 34 additions and 36 deletions

View File

@ -267,17 +267,23 @@
$document['title'] = $text['title-contact-add']; $document['title'] = $text['title-contact-add'];
} }
//set the mode //determine qr branding
if (isset($_SESSION['theme']['qr_image']['text'])) { if ($_SESSION['theme']['qr_brand_type']['text'] == 'image' && $_SESSION['theme']['qr_brand_image']['text'] != '') {
if (strlen($_SESSION['theme']['qr_image']['text']) == 0) { echo "<img id='img-buffer' style='display: none;' src='".$_SESSION["theme"]["qr_brand_image"]["text"]."'>";
$mode = '4'; $qr_option = "image: $('#img-buffer')[0],";
} $qr_mode = '4';
else { $qr_size = '0.2';
$mode = '0'; }
} else if ($_SESSION['theme']['qr_brand_type']['text'] == 'text' && $_SESSION['theme']['qr_brand_text']['text'] != '') {
$qr_option = 'label: "'.$_SESSION['theme']['qr_brand_text']['text'].'"';
$qr_mode = '2';
$qr_size = '0.05';
} }
else { else {
$mode = '4'; echo "<img id='img-buffer' style='display: none;' src='".PROJECT_PATH."/themes/".$_SESSION["domain"]["template"]["name"]."/images/qr_code.png'>";
$qr_option = "image: $('#img-buffer')[0],";
$qr_mode = '4';
$qr_size = '0.2';
} }
//qr code generation //qr code generation
@ -289,10 +295,10 @@
echo " #qr_code_container {"; echo " #qr_code_container {";
echo " z-index: 999999; "; echo " z-index: 999999; ";
echo " position: absolute; "; echo " position: absolute; ";
echo " left: 0px; "; echo " left: 0; ";
echo " top: 0px; "; echo " top: 0; ";
echo " right: 0px; "; echo " right: 0; ";
echo " bottom: 0px; "; echo " bottom: 0; ";
echo " text-align: center; "; echo " text-align: center; ";
echo " vertical-align: middle;"; echo " vertical-align: middle;";
echo " }"; echo " }";
@ -308,32 +314,24 @@
echo "<script src='".PROJECT_PATH."/resources/jquery/jquery-qrcode.min.js'></script>"; echo "<script src='".PROJECT_PATH."/resources/jquery/jquery-qrcode.min.js'></script>";
echo "<script language='JavaScript' type='text/javascript'>"; echo "<script language='JavaScript' type='text/javascript'>";
echo " $(document).ready(function() {"; echo " $(document).ready(function() {";
echo " $(window).on('load', function() {"; echo " $('#qr_code').qrcode({ ";
echo " $('#qr_code').qrcode({ "; echo " render: 'canvas', ";
echo " render: 'canvas', "; echo " minVersion: 6, ";
echo " minVersion: 6, "; echo " maxVersion: 40, ";
echo " maxVersion: 40, "; echo " ecLevel: 'H', ";
echo " ecLevel: 'H', "; echo " size: 650, ";
echo " size: 650, "; echo " radius: 0.2, ";
echo " radius: 0.2, "; echo " quiet: 6, ";
echo " quiet: 6, "; echo " background: '#fff', ";
echo " background: '#fff', "; echo " mode: ".$qr_mode.", ";
echo " mode: ".$mode.", "; echo " mSize: ".$qr_size.", ";
echo " mSize: 0.2, "; echo " mPosX: 0.5, ";
echo " mPosX: 0.5, "; echo " mPosY: 0.5, ";
echo " mPosY: 0.5, "; echo " text: document.getElementById('qr_vcard').value, ";
echo " image: $('#img-buffer')[0], "; echo " ".$qr_option;
echo " text: document.getElementById('qr_vcard').value ";
echo " });";
echo " });"; echo " });";
echo " });"; echo " });";
echo "</script>"; echo "</script>";
if (isset($_SESSION['theme']['qr_image'])) {
echo "<img id='img-buffer' src='".$_SESSION["theme"]["qr_image"]["text"]."' style='display: none;'>";
}
else {
echo "<img id='img-buffer' src='".PROJECT_PATH."/themes/".$_SESSION["domain"]["template"]["name"]."/images/qr_code.png' style='display: none;'>";
}
//show the content //show the content
echo "<form method='post' name='frm' action=''>\n"; echo "<form method='post' name='frm' action=''>\n";