]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 25 Nov 2014 17:54:20 +0000 (17:54 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 25 Nov 2014 17:54:20 +0000 (17:54 +0000)
inc/commons/class.common.tools.php

index 559bfc6e3dbc66f3da8b76d058805a7a0f8328bb..32be77ce80e370ff57563c2188e9839d09bfb0ad 100644 (file)
@@ -78,11 +78,32 @@ class commonTools {
                return $res;
        }
 
+       public static function tubeMeta($args) {
+               $url = $_GET['u'];
+               $hash = sha1($url);
+
+               $web = '/tube/' . $hash . '/';
+               $dir = ROOT . $web;
+
+               header('Content-type: application/json');
+               ob_end_clean();
+
+               $poster = $dir . 'video.jpg';
+               if (file_exists($poster)) {
+                       $dim = getimagesize($poster);
+               }
+
+               $res = array('width' => $dim[0],
+                       'height' => $dim[1],
+                       'ratio' => round($dim[0] / $dim[1], 5));
+
+               echo json_encode($res);
+               exit;
+       }
+
        public static function tube($args) {
                global $css, $js, $jsnomerge, $jsvar;
 
-               fb($_GET);
-
                $css = array();
                $js[] = JS_PATH . '/tube.js';
                $jsnomerge[] = JS_PATH . '/flashdetect.js';
@@ -120,26 +141,26 @@ class commonTools {
                $autoplay = isset($_GET['autoplay']) ? $_GET['autoplay'] : 0;
                $controls = isset($_GET['controls']) ? $_GET['controls'] : 1;
                $displayPoster = isset($_GET['poster']) ? $_GET['poster'] : 1;
-               $background = isset($_GET['background']) ? $_GET['background'] : '#000000';
+               $background = isset($_GET['background']) ? $_GET['background'] : '000000';
+               $background = trim($background, '# ');
 
                $fv = array('video' => $url,
                        'autoPlay' => $autoplay == 1,
                        'controls' => $controls == 1,
                        'loop' => $loop == 1,
-                       'background' => trim($background, '#'));
-
+                       'background' => $background);
 
                if (file_exists($dir . 'video.jpg')) {
                        if ($displayPoster) {
                                $poster = $web . 'video.jpg';
-                               $fv['poster'] = $web . $poster;
+                               $fv['poster'] = $poster;
                        }
                        $dim = getimagesize($dir . 'video.jpg');
                }
 
                $res = '<style type="text/css">';
                $res.='html, body {margin: 0;padding: 0;height: 100%;color:#fff;overflow:hidden;}';
-               $res.='body,video{background:' . $background . ';}';
+               $res.='body,video{background:#' . $background . ';}';
                $res.='video{width:100%;height:100%;display:none;}';
                $res.='#header,#videoflash,#videohtml,#ajaxLoader{display:none;}';
                $res.='</style>';
@@ -170,9 +191,7 @@ class commonTools {
 
                $res.=$video;
                $res.=$flash;
-               //ob_end_clean();
                echo $res;
-               //exit;
        }
 
        public static function browserInfos($args) {