From 3019efef0df41df555611e01de3cfc3e34695381 Mon Sep 17 00:00:00 2001 From: Julian Prieber Date: Fri, 13 Dec 2024 19:07:40 +0100 Subject: [PATCH] Refactor QR code generation - disable png codes for faster load times --- resources/views/layouts/sidebar.blade.php | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/resources/views/layouts/sidebar.blade.php b/resources/views/layouts/sidebar.blade.php index 17fbdb5..eeba3cb 100755 --- a/resources/views/layouts/sidebar.blade.php +++ b/resources/views/layouts/sidebar.blade.php @@ -686,17 +686,10 @@ $usrhandl = Auth::user()->littlelink_name; $argValues = config('advanced-config.qr_code_gradient') ?? [0, 0, 0, 0, 0, 0, 'diagonal']; list($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7) = $argValues; - if (extension_loaded('imagick')) { - $imgSrc = QrCode::format('png')->gradient($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7)->eye('circle')->style('round')->size(1000)->generate($redirectURL); - $imgSrc = base64_encode($imgSrc); - $imgSrc = 'data:image/png;base64,' . $imgSrc; - $imgType = 'png'; - } else { - $imgSrc = QrCode::gradient($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7)->eye('circle')->style('round')->size(1000)->generate($redirectURL); - $imgSrc = base64_encode($imgSrc); - $imgSrc = 'data:image/svg+xml;base64,' . $imgSrc; - $imgType = 'svg'; - } + $imgSrc = QrCode::gradient($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7)->eye('circle')->style('round')->size(1000)->generate($redirectURL); + $imgSrc = base64_encode($imgSrc); + $imgSrc = 'data:image/svg+xml;base64,' . $imgSrc; + $imgType = 'svg'; } catch(exception $e) { $imgSrc = url('/assets/linkstack/images/themes/no-preview.png');