|
@@ -64,6 +64,8 @@ class QRImage extends QROutputAbstract{
|
|
|
* @inheritDoc
|
|
* @inheritDoc
|
|
|
*/
|
|
*/
|
|
|
public function dump(string $file = null):string{
|
|
public function dump(string $file = null):string{
|
|
|
|
|
+ $file ??= $this->options->cachefile;
|
|
|
|
|
+
|
|
|
$this->image = imagecreatetruecolor($this->length, $this->length);
|
|
$this->image = imagecreatetruecolor($this->length, $this->length);
|
|
|
|
|
|
|
|
// avoid: Indirect modification of overloaded property $imageTransparencyBG has no effect
|
|
// avoid: Indirect modification of overloaded property $imageTransparencyBG has no effect
|
|
@@ -83,7 +85,11 @@ class QRImage extends QROutputAbstract{
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $imageData = $this->dumpImage($file);
|
|
|
|
|
|
|
+ $imageData = $this->dumpImage();
|
|
|
|
|
+
|
|
|
|
|
+ if($file !== null){
|
|
|
|
|
+ $this->saveToFile($imageData, $file);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if((bool)$this->options->imageBase64){
|
|
if((bool)$this->options->imageBase64){
|
|
|
$imageData = sprintf('data:image/%s;base64,%s', $this->options->outputType, base64_encode($imageData));
|
|
$imageData = sprintf('data:image/%s;base64,%s', $this->options->outputType, base64_encode($imageData));
|
|
@@ -109,13 +115,9 @@ class QRImage extends QROutputAbstract{
|
|
|
/**
|
|
/**
|
|
|
* @param string|null $file
|
|
* @param string|null $file
|
|
|
*
|
|
*
|
|
|
- * @return string
|
|
|
|
|
-
|
|
|
|
|
* @throws \chillerlan\QRCode\Output\QRCodeOutputException
|
|
* @throws \chillerlan\QRCode\Output\QRCodeOutputException
|
|
|
*/
|
|
*/
|
|
|
- protected function dumpImage(string $file = null):string{
|
|
|
|
|
- $file ??= $this->options->cachefile;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ protected function dumpImage():string{
|
|
|
ob_start();
|
|
ob_start();
|
|
|
|
|
|
|
|
try{
|
|
try{
|
|
@@ -133,10 +135,6 @@ class QRImage extends QROutputAbstract{
|
|
|
|
|
|
|
|
ob_end_clean();
|
|
ob_end_clean();
|
|
|
|
|
|
|
|
- if($file !== null){
|
|
|
|
|
- $this->saveToFile($imageData, $file);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
return $imageData;
|
|
return $imageData;
|
|
|
}
|
|
}
|
|
|
|
|
|