From: Vincent Vanwaelscappel Date: Tue, 12 Sep 2023 16:25:03 +0000 (+0200) Subject: wip #6273 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=4e2997b739135aa1456d8f4ccc57eaded5073fba;p=fluidbook_tools.git wip #6273 @0.25 --- 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 ''; + }); + }