From e5e9009aab613e399d8f97bcfc5b1773d922aea4 Mon Sep 17 00:00:00 2001 From: smiley Date: Wed, 29 Oct 2025 20:41:19 +0100 Subject: [PATCH] :shower: --- examples/imageWithText.php | 1 - examples/svgMeltedModules.php | 2 +- examples/svgModuleGroupShape.php | 8 ++++++-- examples/svgRandomColoredDots.php | 2 +- examples/svgRoundQuietzone.php | 4 ++-- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/examples/imageWithText.php b/examples/imageWithText.php index b81e305de..04e0b4984 100644 --- a/examples/imageWithText.php +++ b/examples/imageWithText.php @@ -73,7 +73,6 @@ class QRImageWithText extends QRGdImagePNG{ // copy over the qrcode imagecopymerge($this->image, $qrcode, 0, 0, 0, 0, $this->length, $this->length, 100); - imagedestroy($qrcode); $fontColor = imagecolorallocate($this->image, ...$textColor); $w = imagefontwidth($textSize); diff --git a/examples/svgMeltedModules.php b/examples/svgMeltedModules.php index da66a5398..218e163d8 100644 --- a/examples/svgMeltedModules.php +++ b/examples/svgMeltedModules.php @@ -59,7 +59,7 @@ class MeltedSVGQRCodeOutput extends QRMarkupSVG{ // collect the modules per $M_TYPE $module = $this->moduleTransform($x, $y, $M_TYPE, $M_TYPE_LAYER); - if(!empty($module)){ + if($module !== null){ $paths[$M_TYPE_LAYER][] = $module; } } diff --git a/examples/svgModuleGroupShape.php b/examples/svgModuleGroupShape.php index 00f32bb02..438753cb0 100644 --- a/examples/svgModuleGroupShape.php +++ b/examples/svgModuleGroupShape.php @@ -56,7 +56,7 @@ class GroupShapeSVGQRCodeOutput extends QRMarkupSVG{ // collect the modules per $M_TYPE $module = $this->moduleTransform($x, $y, $M_TYPE, $M_TYPE_LAYER); - if(!empty($module)){ + if($module !== null){ $paths[$M_TYPE_LAYER][] = $module; } } @@ -68,7 +68,7 @@ class GroupShapeSVGQRCodeOutput extends QRMarkupSVG{ return $paths; } - protected function moduleTransform(int $x, int $y, int $M_TYPE, int $M_TYPE_LAYER):string{ + protected function moduleTransform(int $x, int $y, int $M_TYPE, int $M_TYPE_LAYER):string|null{ $bits = $this->matrix->checkNeighbours($x, $y, null); $check = fn(int $all, int $any = 0):bool => ($bits & ($all | (~$any & 0xff))) === $all; @@ -76,6 +76,10 @@ class GroupShapeSVGQRCodeOutput extends QRMarkupSVG{ ? $this->darkModule($check, $this->options->inverseMelt) : $this->lightModule($check, $this->options->inverseMelt); + if($template === ''){ + return null; + } + $r = $this->options->meltRadius; return sprintf($template, $x, $y, $r, (1 - $r), (1 - 2 * $r)); diff --git a/examples/svgRandomColoredDots.php b/examples/svgRandomColoredDots.php index 80079b782..054825444 100644 --- a/examples/svgRandomColoredDots.php +++ b/examples/svgRandomColoredDots.php @@ -65,7 +65,7 @@ class RandomDotsSVGOutput extends QRMarkupSVG{ // collect the modules per $M_TYPE $module = $this->moduleTransform($x, $y, $M_TYPE, $M_TYPE_LAYER); - if(!empty($module)){ + if($module !== null){ $paths[$M_TYPE_LAYER][] = $module; } } diff --git a/examples/svgRoundQuietzone.php b/examples/svgRoundQuietzone.php index a13938902..839c5f568 100644 --- a/examples/svgRoundQuietzone.php +++ b/examples/svgRoundQuietzone.php @@ -53,7 +53,7 @@ class RoundQuietzoneSVGoutput extends QRMarkupSVG{ // start SVG output $svg = $this->header(); - if(!empty($this->options->svgDefs)){ + if($this->options->svgDefs !== ''){ $svg .= sprintf('%1$s%2$s%2$s', $this->options->svgDefs, $this->options->eol); } @@ -186,7 +186,7 @@ class RoundQuietzoneSVGoutput extends QRMarkupSVG{ // collect the modules per $M_TYPE $module = $this->moduleTransform($x, $y, $M_TYPE, $M_TYPE_LAYER); - if(!empty($module)){ + if($module !== null){ $paths[$M_TYPE_LAYER][] = $module; } }