]> _ Git - fluidbook_tools.git/commitdiff
wip #6100 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 3 Jul 2023 14:50:01 +0000 (16:50 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 3 Jul 2023 14:50:01 +0000 (16:50 +0200)
src/Links/HTMLMultimediaPopupImage.php
src/Links/HTMLMultimediaPopupLink.php

index c3860d6376536c0aed2d89526a65d479c78c4f4c..f23ff45637910becda6b3abd45493f775944f067 100644 (file)
@@ -22,8 +22,8 @@ class HTMLMultimediaPopupImage extends NormalLink {
         $path = $this->compiler->working_path($this->to);
         try {
             $dim = Image::getimagesize($path);
-        }catch (\Exception $e){
-            throw new \Exception('Invalid image on link ' . $this->uid . ' (page ' . $this->page . ') : '.$e->getMessage());
+        } catch (\Exception $e) {
+            throw new \Exception('Invalid image on link ' . $this->uid . ' (page ' . $this->page . ') : ' . $e->getMessage());
         }
 
         if (is_array($dim) && ($this->video_width || $this->video_height)) {
@@ -37,7 +37,10 @@ class HTMLMultimediaPopupImage extends NormalLink {
         if ($this->read_mode) {
             $read = ' data-readmode="1"';
         }
-        return $res . ' ' . $read . ' data-multimedia="' . rawurlencode($markup) . '" ';
+
+        $statsName = str_replace('.pdf.svg', '.pdf', $this->to);
+
+        return $res . ' ' . $read . ' data-stats-type="popup_image" data-stats-name="' . $statsName . '" data-multimedia="' . rawurlencode($markup) . '" ';
     }
 
     public function keep() {
index ab030e8b588b645acbc9e545a1b524afdda44f4f..ce371daf6cef9b5cc1a1ca8822cd449aca0c989f 100644 (file)
@@ -2,11 +2,9 @@
 
 namespace Fluidbook\Tools\Links;
 
-class HTMLMultimediaPopupLink extends htmlMultimediaPopupImage
-{
+class HTMLMultimediaPopupLink extends htmlMultimediaPopupImage {
 
-    public function getAdditionnalContent()
-    {
+    public function getAdditionnalContent() {
         $i = $this->_init;
         $i['inline'] = true;
         $i['in_popup'] = true;
@@ -15,6 +13,6 @@ class HTMLMultimediaPopupLink extends htmlMultimediaPopupImage
 
         $l = self::getMultimediaInstance($this->id . '_content', $i, $this->compiler);
         $markup = $l->getHTMLContainer();
-        return ' data-multimedia="' . rawurlencode($markup) . '" ';
+        return ' data-stats-type="popup_multimedia" data-stats-name="' . $this->to . '" data-multimedia="' . rawurlencode($markup) . '" ';
     }
 }