Skip to content

Commit

Permalink
Merge pull request #71 from ikhsan3adi/optional-qr-logo
Browse files Browse the repository at this point in the history
feat: Generate QR code without logo by default
  • Loading branch information
ikhsan3adi authored May 19, 2024
2 parents b636609 + e119c78 commit d06d64c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ CI_ENVIRONMENT = production
# app.forceGlobalSecureRequests = true
# app.CSPEnabled = false

# Tentukan apakah akan memakai logo di qr code atau tidak
# true|false
QR_LOGO=false

#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------
Expand Down
6 changes: 4 additions & 2 deletions app/Controllers/Admin/QRGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class QRGenerator extends BaseController
{
protected QrCode $qrCode;
protected PngWriter $writer;
protected Logo $logo;
protected ?Logo $logo;
protected Label $label;
protected Font $labelFont;
protected Color $foregroundColor;
Expand All @@ -43,7 +43,9 @@ public function __construct()
$this->backgroundColor = new Color(255, 255, 255);

// Create logo
$this->logo = Logo::create($PUBLIC_PATH . 'assets/img/logo_sekolah.jpg')->setResizeToWidth(75);
$this->logo = boolval(env('QR_LOGO'))
? Logo::create($PUBLIC_PATH . 'assets/img/logo_sekolah.jpg')->setResizeToWidth(75)
: null;

$this->label = Label::create('')
->setFont($this->labelFont)
Expand Down

0 comments on commit d06d64c

Please sign in to comment.