From 4e2997b739135aa1456d8f4ccc57eaded5073fba Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 12 Sep 2023 18:25:03 +0200 Subject: [PATCH] wip #6273 @0.25 --- src/Links/Link.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Links/Link.php b/src/Links/Link.php index 2fe5fd5..a5bb666 100644 --- a/src/Links/Link.php +++ b/src/Links/Link.php @@ -13,6 +13,7 @@ use Cubist\Util\ObjectUtil; use Cubist\Util\Text; use Cubist\Util\Xml; use Fluidbook\Tools\Compiler\CompilerInterface; +use Illuminate\Support\Facades\Cache; use SodiumException; use stdClass; @@ -912,6 +913,7 @@ class Link */ public static function scanQRCode($link, $compiler) { + $image = ZoomLink::generateImage([ 'id' => $link['uid'], 'page' => $link['page'], @@ -926,14 +928,17 @@ class Link 'borderColor' => '', ], $compiler, 'qrcodereader', 'qrcode', false, false); - return ':)'; - try { - $result = (new QRCode)->readFromFile($image); - return (string)$result; - } catch (\Exception $e) { - } - return ''; + return Cache::rememberForever('qrcode_' . hash('sha256', $image), function () use ($image) { + try { + $result = (new QRCode)->readFromFile($image); + return (string)$result; + } catch (\Exception $e) { + + } + return ''; + }); + } -- 2.39.5