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());
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');
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];
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()
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()