Skip to content

Commit

Permalink
Fixes handling of $draw_quiet_zone parameter
Browse files Browse the repository at this point in the history
Previously, output image was always enlarged by quiet zone region, no matter if $draw_quiet_zone is true or false.
  • Loading branch information
gseric authored Jan 5, 2017
1 parent ab09b42 commit 657768b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/QrCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,9 @@ public function create()
++$i;
}

$mib = $max_modules_1side + 8;
$mib = $max_modules_1side;
if ($this->draw_quiet_zone)
$mib += 8;

if ($this->size == 0) {
$this->size = $mib * $qrcode_module_size;
Expand Down Expand Up @@ -1458,7 +1460,7 @@ public function create()
if ($this->draw_quiet_zone == true) {
imagecopyresampled($output_image, $base_image, $this->padding, $this->padding, 0, 0, $this->size, $this->size, $mib, $mib);
} else {
imagecopyresampled($output_image, $base_image, $this->padding, $this->padding, 4, 4, $this->size, $this->size, $mib - 8, $mib - 8);
imagecopyresampled($output_image, $base_image, $this->padding, $this->padding, 4, 4, $this->size, $this->size, $mib, $mib);
}

if ($this->draw_border == true) {
Expand Down

0 comments on commit 657768b

Please sign in to comment.