Skip to content

Commit

Permalink
QR code gradient can now be changed
Browse files Browse the repository at this point in the history
In Advanced Config:

'qr_code_gradient' => [224, 36, 252, 35, 199, 225, 'diagonal'],

In RGB
  • Loading branch information
JulianPrieber committed Dec 6, 2023
1 parent 3b97251 commit 57b501b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions resources/views/layouts/sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -683,13 +683,16 @@
try {
$redirectURL = url('').'/'.'u/'.Auth::user()->id;
$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(224, 36, 252, 35, 199, 225,'diagonal')->eye('circle')->style('round')->size(1000)->generate($redirectURL);
$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(224, 36, 252, 35, 199, 225,'diagonal')->eye('circle')->style('round')->size(1000)->generate($redirectURL);
$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';
Expand Down

0 comments on commit 57b501b

Please sign in to comment.