From 552d1581f63ad0b70c58ecd056fd15307117f055 Mon Sep 17 00:00:00 2001 From: codemasher Date: Sat, 4 Apr 2020 03:57:17 +0200 Subject: [PATCH] :shower: --- examples/QRImageWithText.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/QRImageWithText.php b/examples/QRImageWithText.php index e0dd18d71..4923b5087 100644 --- a/examples/QRImageWithText.php +++ b/examples/QRImageWithText.php @@ -26,6 +26,8 @@ class QRImageWithText extends QRImage{ * @return string */ public function dump(string $file = null, string $text = null):string{ + $file ??= $this->options->cachefile; + $this->image = \imagecreatetruecolor($this->length, $this->length); $background = \imagecolorallocate($this->image, ...$this->options->imageTransparencyBG); @@ -46,7 +48,11 @@ class QRImageWithText extends QRImage{ $this->addText($text); } - $imageData = $this->dumpImage($file); + $imageData = $this->dumpImage(); + + if($file !== null){ + $this->saveToFile($imageData, $file); + } if((bool)$this->options->imageBase64){ $imageData = 'data:image/'.$this->options->outputType.';base64,'.\base64_encode($imageData);