From: Vincent Vanwaelscappel Date: Thu, 14 Oct 2021 18:53:21 +0000 (+0200) Subject: wip #4793 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=6d01b92012d3482421527a1e07441c64bd1b63ea;p=odl.git wip #4793 @0.25 --- diff --git a/app/Jobs/ProcessFluidbook.php b/app/Jobs/ProcessFluidbook.php index bbe5e81..e254cd9 100644 --- a/app/Jobs/ProcessFluidbook.php +++ b/app/Jobs/ProcessFluidbook.php @@ -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; }