]> _ Git - odl.git/commitdiff
wip #4793 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 14 Oct 2021 18:53:21 +0000 (20:53 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 14 Oct 2021 18:53:21 +0000 (20:53 +0200)
app/Jobs/ProcessFluidbook.php

index bbe5e81eeaeeb6fa4d071c9635b1c7321e6164e9..e254cd97ab5dda00f268d7e392e681b4f512d52d 100644 (file)
@@ -64,6 +64,24 @@ class ProcessFluidbook extends Compiler
         return $fname;
     }
 
+    protected function _zipAssets($id)
+    {
+        /** @var Asset $asset */
+        $asset = Asset::find($id);
+        $collection = $asset->getMediaInField($asset->getAttributeValue('file_upload'));
+        $tmp = Files::tmpdir();
+        $zip = Files::tempnam() . '.zip';
+
+        foreach ($collection as $item) {
+            /** @var $item Media */
+            copy($item->getPath(), $tmp);
+        }
+        Zip::archive($tmp, $zip);
+        Files::rmdir($tmp);
+        return $zip;
+    }
+
+
     public function getLinks()
     {
         $links = $this->getLinksFromPDF();
@@ -107,6 +125,14 @@ class ProcessFluidbook extends Compiler
                     $link['loop'] = false;
                     $link['sound'] = true;
                 }
+            } else if (stripos($e[0], 'slideshow/') === 0) {
+                $link['inline'] = $e[0] === 'slideshow/inline';
+                $link['to'] = $this->_zipAssets($e[1]);
+                if ($link['inline']) {
+                    $link['type'] = 15;
+                } else {
+                    $link['type'] = 30;
+                }
             }
             $res[$k] = $link;
         }