]> _ Git - cubeextranet.git/commitdiff
wait #3909 @0.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 5 Oct 2020 16:36:56 +0000 (16:36 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 5 Oct 2020 16:36:56 +0000 (16:36 +0000)
inc/ws/Util/html5/master/class.ws.html5.links.php

index 4c624e3b8b400e871be5a6d2cc906dc2de720aca..18027292d7c4d656a44545d4a9d3b615b0d530ff 100644 (file)
@@ -986,7 +986,9 @@ class videoLink extends wsHTML5Link
 
     public function getHTMLContent()
     {
-        $this->copyExternalFile($this->to, true);
+        if (!CubeIT_Util_Url::isDistant($this->to)) {
+            $this->copyExternalFile($this->to, true);
+        }
 
         $w = round($this->width * $this->getCssScale());
         $h = round($this->height * $this->getCssScale());
@@ -1016,12 +1018,7 @@ class videoLink extends wsHTML5Link
     public static function getVideoAttributes($data, $w = null, $h = null, $compiler = null)
     {
 
-        $file = $data->to;
-        $e = explode('.', $file);
-        $ext = array_pop($e);
-        $basename = implode('.', $e);
-
-        $attr['name'] = $basename;
+        $attr['name'] = videoPopupLink::getBasename($data->to);
         $attr['id'] = 'video_' . $data->id;
         $attr['autoplay'] = ($data->video_auto_start ? '1' : '0');
         $attr['controls'] = ($data->video_controls ? '1' : '0');
@@ -1032,13 +1029,13 @@ class videoLink extends wsHTML5Link
         if (!is_null($w) && !is_null($h)) {
             $attr['width'] = $w;
             $attr['height'] = $h;
-        } else if (!is_null($compiler)) {
+        } else if (!is_null($compiler) && CubeIT_Util_Url::isLocal($data->to)) {
             // Get video dimensions from thumbnail if possible (locally uploaded files)
 //            $path = WS_BOOKS . '/working/' . $compiler->book_id . '/' . $basename . '.jpg';
 //            $dim = getimagesize($path);
 //            $attr['width'] = $dim[0];
 //            $attr['height'] = $dim[1];
-            $path = WS_BOOKS . '/working/' . $compiler->book_id . '/' . $file;
+            $path = WS_BOOKS . '/working/' . $compiler->book_id . '/' . $data->to;
             $e = explode(',', `ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 $path`);
             $attr['width'] = $e[0];
             $attr['height'] = $e[1];
@@ -1052,15 +1049,25 @@ class videoLink extends wsHTML5Link
 class videoPopupLink extends normalLink
 {
 
-    public function getURL()
+    public static function getBasename($f)
     {
-        $this->copyExternalFile($this->to, true);
-        $file = $this->to;
-        $e = explode('.', $file);
-        $ext = array_pop($e);
-        $basename = implode('.', $e);
+        $prefix = '';
+        if (CubeIT_Util_Url::isDistant($f)) {
+            $prefix = mb_substr(sha1($f), 0, 10) . '-';
+            $e = explode('/', $f);
+            $f = array_pop($e);
+        }
+        $e = explode('.', $f);
+        array_pop($e);
+        return $prefix . implode('.', $e);
+    }
 
-        return '#/video/' . $basename;
+    public function getURL()
+    {
+        if (!CubeIT_Util_Url::isDistant($this->to)) {
+            $this->copyExternalFile($this->to, true);
+        }
+        return '#/video/' . self::getBasename($this->to);
     }
 
     public function getAdditionnalContent()
@@ -1760,7 +1767,7 @@ class JoueclubWishlistLink extends normalLink
 
     public function getURL()
     {
-        return 'https://listedecadeau.joueclub.fr/scan?deviceId=$uuid&ean=' . $this->to;
+        return 'https://listedecadeau.joueclub.fr/scan?device_id=$uuid&id_from_asset_name=' . $this->to;
     }
 
     public function getTarget()