]> _ Git - fluidbook_tools.git/commitdiff
wip #6273 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 12 Sep 2023 16:25:03 +0000 (18:25 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 12 Sep 2023 16:25:03 +0000 (18:25 +0200)
src/Links/Link.php

index 2fe5fd5c8872e96bbe4117f780427333b4770ffe..a5bb66633294f6ed4101a551f059b73fbe883c2f 100644 (file)
@@ -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 '';
+        });
+
     }