Просмотр исходного кода

:octocat: add QROptionsTrait::$gdImageUseUpscale

smiley 2 лет назад
Родитель
Сommit
8049976e5b
2 измененных файлов с 13 добавлено и 1 удалено
  1. 1 1
      src/Output/QRGdImage.php
  2. 12 0
      src/QROptionsTrait.php

+ 1 - 1
src/Output/QRGdImage.php

@@ -228,7 +228,7 @@ class QRGdImage extends QROutputAbstract{
 	 */
 	protected function createImage(){
 
-		if($this->drawCircularModules && $this->options->scale < 20){
+		if($this->drawCircularModules && $this->options->gdImageUseUpscale && $this->options->scale < 20){
 			// increase the initial image size by 10
 			$this->length   *= 10;
 			$this->scale    *= 10;

+ 12 - 0
src/QROptionsTrait.php

@@ -339,6 +339,18 @@ trait QROptionsTrait{
 	 */
 	protected int $quality = -1;
 
+	/*
+	 * QRGdImage settings
+	 */
+
+	/**
+	 * Toggles the usage of internal upscaling when `QROptions::$drawCircularModules` is set to `true` and
+	 * `QROptions::$scale` is less than 20
+	 *
+	 * @see \chillerlan\QRCode\Output\QRGdImage::createImage()
+	 * @see https://github.com/chillerlan/php-qrcode/issues/23
+	 */
+	protected bool $gdImageUseUpscale = true;
 
 	/*
 	 * QRImagick settings