51 lines
2.1 KiB
PHP
51 lines
2.1 KiB
PHP
<?php
|
|
use Endroid\QrCode\ErrorCorrectionLevel;
|
|
use Endroid\QrCode\LabelAlignment;
|
|
use Endroid\QrCode\QrCode;
|
|
use Endroid\QrCode\Response\QrCodeResponse;
|
|
|
|
class Imgqrcode extends CI_Controller {
|
|
function test() {
|
|
$qrCode = new QrCode('Life is too short to be generating QR codes');
|
|
|
|
header('Content-Type: '.$qrCode->getContentType());
|
|
echo $qrCode->writeString();
|
|
}
|
|
function show($qrcode) {
|
|
$qrCode = new QrCode("pre-order qrcode\ngenerated by s.a.s\n" . "[". $qrcode ."]");
|
|
$qrCode->setSize(300);
|
|
// Set advanced options
|
|
$qrCode->setWriterByName('png');
|
|
$qrCode->setMargin(10);
|
|
$qrCode->setEncoding('UTF-8');
|
|
$qrCode->setErrorCorrectionLevel(new ErrorCorrectionLevel(ErrorCorrectionLevel::HIGH));
|
|
$qrCode->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0]);
|
|
$qrCode->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255, 'a' => 0]);
|
|
$qrCode->setLabel('S.A.S PreOrder', 16, FCPATH .'/assets/fonts/noto_sans.otf', LabelAlignment::CENTER);
|
|
$qrCode->setLogoPath(FCPATH . '/assets/images/logo-sas.jpg');
|
|
$qrCode->setLogoWidth(150);
|
|
$qrCode->setValidateResult(false);
|
|
header('Content-Type: '.$qrCode->getContentType());
|
|
echo $qrCode->writeString();
|
|
}
|
|
function index() {
|
|
$qrCode = new QrCode("TUV345");
|
|
$qrCode->setSize(300);
|
|
//
|
|
// Set advanced options
|
|
$qrCode->setWriterByName('png');
|
|
$qrCode->setMargin(10);
|
|
$qrCode->setEncoding('UTF-8');
|
|
$qrCode->setErrorCorrectionLevel(new ErrorCorrectionLevel(ErrorCorrectionLevel::HIGH));
|
|
$qrCode->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0]);
|
|
$qrCode->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255, 'a' => 0]);
|
|
$qrCode->setLabel('S.A.S PreOrder', 16, FCPATH .'/assets/fonts/noto_sans.otf', LabelAlignment::CENTER);
|
|
$qrCode->setLogoPath(FCPATH . '/assets/images/logo-sas.jpg');
|
|
$qrCode->setLogoWidth(150);
|
|
$qrCode->setValidateResult(false);
|
|
header('Content-Type: '.$qrCode->getContentType());
|
|
echo $qrCode->writeString();
|
|
}
|
|
}
|
|
?>
|