🛀 examples cleanup

This commit is contained in:
smiley
2023-09-03 15:29:24 +02:00
parent 17e8ccae62
commit a19b7f4fbd
19 changed files with 571 additions and 539 deletions
+27 -16
View File
@@ -1,5 +1,7 @@
<?php
/**
* GdImage with logo output example
*
* @created 18.11.2020
* @author smiley <smiley@chillerlan.net>
* @copyright 2020 smiley
@@ -70,33 +72,42 @@ class QRImageWithLogo extends QRGdImage{
}
/*
* Runtime
*/
$options = new QROptions([
'version' => 5,
'eccLevel' => EccLevel::H,
'imageBase64' => false,
'addLogoSpace' => true,
'logoSpaceWidth' => 13,
'logoSpaceHeight' => 13,
'scale' => 6,
'imageTransparent' => false,
'drawCircularModules' => true,
'circleRadius' => 0.45,
'keepAsSquare' => [QRMatrix::M_FINDER, QRMatrix::M_FINDER_DOT],
]);
$options = new QROptions;
$options->version = 5;
$options->imageBase64 = false;
$options->scale = 6;
$options->imageTransparent = false;
$options->drawCircularModules = true;
$options->circleRadius = 0.45;
$options->keepAsSquare = [
QRMatrix::M_FINDER,
QRMatrix::M_FINDER_DOT,
];
// ecc level H is required for logo space
$options->eccLevel = EccLevel::H;
$options->addLogoSpace = true;
$options->logoSpaceWidth = 13;
$options->logoSpaceHeight = 13;
$qrcode = new QRCode($options);
$qrcode->addByteSegment('https://github.com');
header('Content-type: image/png');
$qrOutputInterface = new QRImageWithLogo($options, $qrcode->getQRMatrix());
// dump the output, with an additional logo
// the logo could also be supplied via the options, see the svgWithLogo example
echo $qrOutputInterface->dump(null, __DIR__.'/octocat.png');
$out = $qrOutputInterface->dump(null, __DIR__.'/octocat.png');
header('Content-type: image/png');
echo $out;
exit;