From 3bc92a3bf3480e5d2fe23645c3752464e71ec7eb Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 5 Oct 2020 16:36:56 +0000 Subject: [PATCH] wait #3909 @0.5 --- .../html5/master/class.ws.html5.links.php | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/inc/ws/Util/html5/master/class.ws.html5.links.php b/inc/ws/Util/html5/master/class.ws.html5.links.php index 4c624e3b8..18027292d 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -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() -- 2.39.5