From e119c7884a3d91efef3772e40b4589f401aaea24 Mon Sep 17 00:00:00 2001 From: Ikhsan S <93766033+ikhsan3adi@users.noreply.github.com> Date: Sun, 19 May 2024 13:37:31 +0700 Subject: [PATCH] feat: Generate QR code without logo by default --- .env.example | 4 ++++ app/Controllers/Admin/QRGenerator.php | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 8aac702..48b9c1a 100644 --- a/.env.example +++ b/.env.example @@ -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 #-------------------------------------------------------------------- diff --git a/app/Controllers/Admin/QRGenerator.php b/app/Controllers/Admin/QRGenerator.php index c42a85d..28ccd38 100644 --- a/app/Controllers/Admin/QRGenerator.php +++ b/app/Controllers/Admin/QRGenerator.php @@ -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; @@ -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)