🛀 fix examples

This commit is contained in:
codemasher
2020-11-22 10:12:20 +01:00
parent d58c2044f1
commit 4aec4d2c3c
10 changed files with 38 additions and 30 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ class MyCustomOutput extends QROutputAbstract{
// TODO: Implement setModuleValues() method.
}
public function dump(string $file = null){
public function dump(string $file = null):string{
$output = '';
+5 -5
View File
@@ -41,9 +41,9 @@ class QRImageWithLogo extends QRImage{
}
$this->matrix->setLogoSpace(
$this->options->logoWidth,
$this->options->logoHeight
// not utilizing the position here
$this->options->logoSpaceWidth,
$this->options->logoSpaceHeight
// not utilizing the position here
);
// there's no need to save the result of dump() into $this->image here
@@ -56,8 +56,8 @@ class QRImageWithLogo extends QRImage{
$h = imagesy($im);
// set new logo size, leave a border of 1 module
$lw = ($this->options->logoWidth - 2) * $this->options->scale;
$lh = ($this->options->logoHeight - 2) * $this->options->scale;
$lw = ($this->options->logoSpaceWidth - 2) * $this->options->scale;
$lh = ($this->options->logoSpaceHeight - 2) * $this->options->scale;
// get the qrcode size
$ql = $this->matrix->size() * $this->options->scale;
+3 -2
View File
@@ -11,6 +11,7 @@
namespace chillerlan\QRCodeExamples;
use chillerlan\QRCode\{QRCode, QROptions};
use chillerlan\QRCode\Common\EccLevel;
require_once __DIR__.'/../vendor/autoload.php';
@@ -19,7 +20,7 @@ $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
// invoke the QROutputInterface manually
$options = new QROptions([
'version' => 5,
'eccLevel' => QRCode::ECC_L,
'eccLevel' => EccLevel::L,
]);
$qrcode = new QRCode($options);
@@ -33,7 +34,7 @@ var_dump($qrOutputInterface->dump());
// or just
$options = new QROptions([
'version' => 5,
'eccLevel' => QRCode::ECC_L,
'eccLevel' => EccLevel::L,
'outputType' => QRCode::OUTPUT_CUSTOM,
'outputInterface' => MyCustomOutput::class,
]);
+2 -1
View File
@@ -3,6 +3,7 @@
namespace chillerlan\QRCodeExamples;
use chillerlan\QRCode\{QRCode, QROptions};
use chillerlan\QRCode\Common\EccLevel;
require_once __DIR__ . '/../vendor/autoload.php';
@@ -11,7 +12,7 @@ $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
$options = new QROptions([
'version' => 7,
'outputType' => QRCode::OUTPUT_FPDF,
'eccLevel' => QRCode::ECC_L,
'eccLevel' => EccLevel::L,
'scale' => 5,
'imageBase64' => false,
'moduleValues' => [
+4 -3
View File
@@ -11,6 +11,7 @@
namespace chillerlan\QRCodeExamples;
use chillerlan\QRCode\{QRCode, QROptions};
use chillerlan\QRCode\Common\EccLevel;
require_once '../vendor/autoload.php';
@@ -60,9 +61,9 @@ header('Content-Type: text/html; charset=utf-8');
$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
$options = new QROptions([
'version' => 5,
'outputType' => QRCode::OUTPUT_MARKUP_HTML,
'eccLevel' => QRCode::ECC_L,
'version' => 5,
'outputType' => QRCode::OUTPUT_MARKUP_HTML,
'eccLevel' => EccLevel::L,
'moduleValues' => [
// finder
1536 => '#A71111', // dark (true)
+2 -1
View File
@@ -11,6 +11,7 @@
namespace chillerlan\QRCodeExamples;
use chillerlan\QRCode\{QRCode, QROptions};
use chillerlan\QRCode\Common\EccLevel;
require_once __DIR__.'/../vendor/autoload.php';
@@ -19,7 +20,7 @@ $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
$options = new QROptions([
'version' => 10,
'outputType' => QRCode::OUTPUT_IMAGE_PNG,
'eccLevel' => QRCode::ECC_H,
'eccLevel' => EccLevel::L,
'scale' => 5,
'imageBase64' => false,
'moduleValues' => [
+8 -7
View File
@@ -11,28 +11,29 @@
namespace chillerlan\QRCodeExamples;
use chillerlan\QRCode\{QRCode, QROptions};
use chillerlan\QRCode\Common\EccLevel;
require_once __DIR__.'/../vendor/autoload.php';
$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
/**
* @property int $logoWidth
* @property int $logoHeight
* @property int $logoSpaceWidth
* @property int $logoSpaceHeight
*
* @noinspection PhpIllegalPsrClassPathInspection
*/
class LogoOptions extends QROptions{
protected int $logoWidth;
protected int $logoHeight;
protected int $logoSpaceWidth;
protected int $logoSpaceHeight;
}
$options = new LogoOptions;
$options->version = 7;
$options->eccLevel = QRCode::ECC_H;
$options->eccLevel = EccLevel::H;
$options->imageBase64 = false;
$options->logoWidth = 13;
$options->logoHeight = 13;
$options->logoSpaceWidth = 13;
$options->logoSpaceHeight = 13;
$options->scale = 5;
$options->imageTransparent = false;
+2 -1
View File
@@ -11,6 +11,7 @@
namespace chillerlan\QRCodeExamples;
use chillerlan\QRCode\{QRCode, QROptions};
use chillerlan\QRCode\Common\EccLevel;
require_once __DIR__.'/../vendor/autoload.php';
@@ -19,7 +20,7 @@ $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
$options = new QROptions([
'version' => 7,
'outputType' => QRCode::OUTPUT_IMAGICK,
'eccLevel' => QRCode::ECC_L,
'eccLevel' => EccLevel::L,
'scale' => 5,
'moduleValues' => [
// finder
+8 -7
View File
@@ -11,6 +11,7 @@
namespace chillerlan\QRCodeExamples;
use chillerlan\QRCode\{QRCode, QROptions};
use chillerlan\QRCode\Common\EccLevel;
require_once __DIR__.'/../vendor/autoload.php';
@@ -18,14 +19,14 @@ $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
$gzip = true;
$options = new QROptions([
'version' => 7,
'outputType' => QRCode::OUTPUT_MARKUP_SVG,
'eccLevel' => QRCode::ECC_L,
'version' => 7,
'outputType' => QRCode::OUTPUT_MARKUP_SVG,
'eccLevel' => EccLevel::L,
'svgViewBoxSize' => 530,
'addQuietzone' => true,
'cssClass' => 'my-css-class',
'svgOpacity' => 1.0,
'svgDefs' => '
'addQuietzone' => true,
'cssClass' => 'my-css-class',
'svgOpacity' => 1.0,
'svgDefs' => '
<linearGradient id="g2">
<stop offset="0%" stop-color="#39F" />
<stop offset="100%" stop-color="#F3F" />
+3 -2
View File
@@ -11,6 +11,7 @@
namespace chillerlan\QRCodeExamples;
use chillerlan\QRCode\{QRCode, QROptions};
use chillerlan\QRCode\Common\EccLevel;
require_once __DIR__.'/../vendor/autoload.php';
@@ -19,7 +20,7 @@ $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
$options = new QROptions([
'version' => 5,
'outputType' => QRCode::OUTPUT_STRING_TEXT,
'eccLevel' => QRCode::ECC_L,
'eccLevel' => EccLevel::L,
]);
// <pre> to view it in a browser
@@ -30,7 +31,7 @@ echo '<pre style="font-size: 75%; line-height: 1;">'.(new QRCode($options))->ren
$options = new QROptions([
'version' => 5,
'outputType' => QRCode::OUTPUT_STRING_TEXT,
'eccLevel' => QRCode::ECC_L,
'eccLevel' => EccLevel::L,
'moduleValues' => [
// finder
1536 => 'A', // dark (true)