Skip to content

Commit 6f001c4

Browse files
committed
🚿 updated examples
1 parent 164116f commit 6f001c4

File tree

4 files changed

+23
-18
lines changed

4 files changed

+23
-18
lines changed

examples/QRImageWithLogo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
namespace chillerlan\QRCodeExamples;
1414

15-
use chillerlan\QRCode\Output\{QRCodeOutputException, QRImage};
15+
use chillerlan\QRCode\Output\{QRGdImage, QRCodeOutputException};
1616

1717
use function imagecopyresampled, imagecreatefrompng, imagesx, imagesy, is_file, is_readable;
1818

19-
class QRImageWithLogo extends QRImage{
19+
class QRImageWithLogo extends QRGdImage{
2020

2121
/**
2222
* @param string|null $file

examples/QRImageWithText.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
namespace chillerlan\QRCodeExamples;
1818

19-
use chillerlan\QRCode\Output\QRImage;
20-
19+
use chillerlan\QRCode\Output\QRGdImage;
20+
use chillerlan\QRCode\QRCode;
2121
use function imagechar, imagecolorallocate, imagecolortransparent, imagecopymerge, imagecreatetruecolor,
22-
imagedestroy, imagefilledrectangle, imagefontwidth, in_array, round, str_split, strlen;
22+
imagedestroy, imagefilledrectangle, imagefontwidth, round, str_split, strlen;
2323

24-
class QRImageWithText extends QRImage{
24+
class QRImageWithText extends QRGdImage{
2525

2626
/**
2727
* @param string|null $file
@@ -74,7 +74,7 @@ protected function addText(string $text):void{
7474
$background = imagecolorallocate($this->image, ...$textBG);
7575

7676
// allow transparency
77-
if($this->options->imageTransparent && in_array($this->options->outputType, $this::TRANSPARENCY_TYPES, true)){
77+
if($this->options->imageTransparent && $this->options->outputType !== QRCode::OUTPUT_IMAGE_JPG){
7878
imagecolortransparent($this->image, $background);
7979
}
8080

examples/imageWithLogo.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,24 @@
1010

1111
use chillerlan\QRCode\{QRCode, QROptions};
1212
use chillerlan\QRCode\Common\EccLevel;
13+
use chillerlan\QRCode\Data\QRMatrix;
1314

1415
require_once __DIR__.'/../vendor/autoload.php';
1516

16-
$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
17+
$data = 'https://github.com';
1718

1819
$options = new QROptions([
19-
'version' => 7,
20-
'eccLevel' => EccLevel::H,
21-
'imageBase64' => false,
22-
'addLogoSpace' => true,
23-
'logoSpaceWidth' => 13,
24-
'logoSpaceHeight' => 13,
25-
'scale' => 5,
26-
'imageTransparent' => false,
20+
'version' => 5,
21+
'eccLevel' => EccLevel::H,
22+
'imageBase64' => false,
23+
'addLogoSpace' => true,
24+
'logoSpaceWidth' => 13,
25+
'logoSpaceHeight' => 13,
26+
'scale' => 6,
27+
'imageTransparent' => false,
28+
'drawCircularModules' => true,
29+
'circleRadius' => 0.45,
30+
'keepAsSquare' => [QRMatrix::M_FINDER, QRMatrix::M_FINDER_DOT],
2731
]);
2832

2933
$qrcode = new QRCode($options);

examples/imagick.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414

1515
require_once __DIR__.'/../vendor/autoload.php';
1616

17-
$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
17+
$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
1818

1919
$options = new QROptions([
2020
'version' => 7,
2121
'outputType' => QRCode::OUTPUT_IMAGICK,
2222
'eccLevel' => EccLevel::L,
23+
'imagickBG' => '#FFFFFF',
2324
'scale' => 20,
2425
'drawCircularModules' => true,
2526
'circleRadius' => 0.4,
@@ -37,7 +38,7 @@
3738
QRMatrix::M_TIMING => '#FFB8E9',
3839
// format
3940
QRMatrix::M_FORMAT | QRMatrix::IS_DARK => '#003804',
40-
QRMatrix::M_FORMAT => '#00FB12',
41+
QRMatrix::M_FORMAT => '#CCFB12',
4142
// version
4243
QRMatrix::M_VERSION | QRMatrix::IS_DARK => '#650098',
4344
QRMatrix::M_VERSION => '#E0B8FF',

0 commit comments

Comments
 (0)