Example #1
0
        $ec = Endroid\QrCode\QrCode::LEVEL_HIGH;
        break;
    case 'Q':
        $ec = Endroid\QrCode\QrCode::LEVEL_QUARTILE;
        break;
    case 'M':
        $ec = Endroid\QrCode\QrCode::LEVEL_MEDIUM;
        break;
    case 'L':
    default:
        $ec = Endroid\QrCode\QrCode::LEVEL_LOW;
        break;
}
$qrCode->setErrorCorrection($ec);
$qrCode->setModuleSize((int) $configs['qrcode_mps'] - 1);
$qrCode->setPadding($configs['qrcode_margin'] * $qrCode->getModuleSize());
$qrCode->setBackgroundColor(normalizeColor($configs['qrcode_bgcolor']));
$qrCode->setForegroundColor(normalizeColor($configs['qrcode_fgcolor']));
//$qrCode->setText("Life is too short to be generating QR codes");
//$qrCode->setSize(300);
try {
    $qrData = $qrCode->get('png');
} catch (\Exception $e) {
    $xoopsPreload->triggerEvent('core.exception', $e);
    $qrData = '';
}
$mimetype = \Xoops\Core\MimeTypes::findType('png');
$expires = 60 * 60 * 24 * 15;
// seconds, minutes, hours, days
header("Cache-Control: public, max-age=" . $expires);
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT');