Initial commit
This commit is contained in:
commit
48a5360d0d
22 changed files with 1687 additions and 0 deletions
51
qrcode.php
Normal file
51
qrcode.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
use Endroid\QrCode\QrCode;
|
||||
use Endroid\QrCode\Writer\PngWriter;
|
||||
|
||||
use Endroid\QrCode\Color\Color;
|
||||
use Endroid\QrCode\Encoding\Encoding;
|
||||
use Endroid\QrCode\ErrorCorrectionLevel;
|
||||
use Endroid\QrCode\Label\Label;
|
||||
use Endroid\QrCode\Logo\Logo;
|
||||
use Endroid\QrCode\RoundBlockSizeMode;
|
||||
use Endroid\QrCode\Writer\ValidationException;
|
||||
|
||||
session_start();
|
||||
|
||||
if (isset($_SESSION['id_token'])) {
|
||||
$url = $_SESSION['url'];
|
||||
} elseif (isset($_GET['url'])) {
|
||||
$url = $_GET['url'];
|
||||
} else {
|
||||
header('Location: index.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
// create QR-Code
|
||||
//$qrCode = new QrCode($url);
|
||||
$qrCode = new QrCode(
|
||||
data: $url,
|
||||
// encoding: new Encoding('UTF-8'),
|
||||
// errorCorrectionLevel: ErrorCorrectionLevel::Low,
|
||||
// size: 300,
|
||||
margin: 0,
|
||||
roundBlockSizeMode: RoundBlockSizeMode::Enlarge,
|
||||
// foregroundColor: new Color(0, 0, 0),
|
||||
// backgroundColor: new Color(255, 255, 255)
|
||||
);
|
||||
//$qrCode->setSize(300); // Größe des QR-Codes
|
||||
//$qrCode->setMargin(0); // Rand um den QR-Code
|
||||
|
||||
// generate QR-Code as png
|
||||
$writer = new PngWriter();
|
||||
$result = $writer->write($qrCode);
|
||||
|
||||
// set header
|
||||
header('Content-Type: '.$result->getMimeType());
|
||||
header('Content-Disposition: inline; filename="qrcode.png"');
|
||||
|
||||
// output QR-Code
|
||||
echo $result->getString();
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue