]> _ Git - fluidbook_tools.git/commitdiff
wip #6015 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 15 Jun 2023 06:56:30 +0000 (08:56 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 15 Jun 2023 06:56:30 +0000 (08:56 +0200)
src/Links/SlideshowLink.php

index cf13da99af14630f5ec3bf530ec1ffb348cca880..78e42f1b4740a150902b03bcdd619b0190165e56 100644 (file)
@@ -13,6 +13,8 @@ class SlideshowLink extends NormalLink {
     protected $allowed_extensions;
     protected $thumbnail_height = 80; // Height in px of thumbnail slider
 
+    protected $baseName = '';
+
     public function getURL() {
 
         if (empty($this->to)) {
@@ -20,6 +22,11 @@ class SlideshowLink extends NormalLink {
         }
 
         $d = $this->unzipFile($this->to, true);
+        $e = explode('.', $this->to);
+        array_pop($e);
+        $this->baseName = implode('.', $e);
+
+
         $this->copyExternalDir($d['dir'], $d['fdir']);
 
         $this->path = $d['fdir'];
@@ -101,7 +108,7 @@ class SlideshowLink extends NormalLink {
         }
 
         // Main slider
-        $res = '<div class="fb-slideshow splide" id="' . $slideshowID . '" data-open-index="' . $this->extra . '" data-thumbnails="' . ($thumbnails ? '1' : '0') . '" data-splide=\'' . json_encode($slideshow_settings) . '\'>' . $this->_slides($slides, $slides_options) . '</div>';
+        $res = '<div class="fb-slideshow splide" data-name="' . $this->baseName . '" id="' . $slideshowID . '" data-open-index="' . $this->extra . '" data-thumbnails="' . ($thumbnails ? '1' : '0') . '" data-splide=\'' . json_encode($slideshow_settings) . '\'>' . $this->_slides($slides, $slides_options) . '</div>';
 
         // Thumbnails slider
         if ($thumbnails) {
@@ -138,7 +145,6 @@ class SlideshowLink extends NormalLink {
     }
 
 
-
     protected function _slides($slides, $options = []) {
         $default_options = [
             'show_captions' => true,
@@ -152,8 +158,8 @@ class SlideshowLink extends NormalLink {
         $res .= '<ul class="splide__list">';
 
         foreach ($slides as $slide) {
-            $s=new \SplFileInfo($slide['path']);
-            $image_path_relative = $this->path.'/'.$s->getFilename();
+            $s = new \SplFileInfo($slide['path']);
+            $image_path_relative = $this->path . '/' . $s->getFilename();
 
             $image_info = Image::getimagesize($slide['path']);
             $image_info_json = ($image_info) ? json_encode(['width' => $image_info[0], 'height' => $image_info[1], 'ratio' => round($image_info[0] / $image_info[1], 4)]) : '';