From d0a8f97a3e9fa9a50ef71e634dcf09277b0129a5 Mon Sep 17 00:00:00 2001 From: codemasher Date: Wed, 31 Jul 2019 00:45:45 +0200 Subject: [PATCH] :octocat: --- examples/QRImageWithText.php | 4 ++-- src/Output/QRImage.php | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/QRImageWithText.php b/examples/QRImageWithText.php index 193c9d2e3..d33ea1045 100644 --- a/examples/QRImageWithText.php +++ b/examples/QRImageWithText.php @@ -88,10 +88,10 @@ class QRImageWithText extends QRImage{ $fontColor = \imagecolorallocate($this->image, ...$textColor); $w = \imagefontwidth($textSize); - $x = round(($bgWidth - strlen($text) * $w) / 2); + $x = \round(($bgWidth - \strlen($text) * $w) / 2); // loop through the string and draw the letters - foreach(str_split($text) as $i => $chr){ + foreach(\str_split($text) as $i => $chr){ \imagechar($this->image, $textSize, $i * $w + $x, $this->length, $chr, $fontColor); } } diff --git a/src/Output/QRImage.php b/src/Output/QRImage.php index 6856d350b..52531e144 100644 --- a/src/Output/QRImage.php +++ b/src/Output/QRImage.php @@ -65,7 +65,11 @@ class QRImage extends QROutputAbstract{ */ public function dump(string $file = null):string{ $this->image = \imagecreatetruecolor($this->length, $this->length); - $background = \imagecolorallocate($this->image, ...$this->options->imageTransparencyBG); + + // avoid: Indirect modification of overloaded property $imageTransparencyBG has no effect + // https://stackoverflow.com/a/10455217 + $tbg = $this->options->imageTransparencyBG; + $background = \imagecolorallocate($this->image, ...$tbg); if((bool)$this->options->imageTransparent && \in_array($this->options->outputType, $this::TRANSPARENCY_TYPES, true)){ \imagecolortransparent($this->image, $background);