aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Linkinfo.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2019-04-27 17:22:00 -0700
committerzotlabs <mike@macgirvin.com>2019-04-27 17:22:00 -0700
commit13970280d91f652d3634e543c027c9f80fab28e9 (patch)
tree2bd90ebe9cac430edb91d405936c9c3c030c206b /Zotlabs/Module/Linkinfo.php
parent55ce80aabea0a810c137e5b9ff71d47bde8fa36b (diff)
parent9536a490b3fc5fc02a6d0a79275e8df03ee8156b (diff)
downloadvolse-hubzilla-13970280d91f652d3634e543c027c9f80fab28e9.tar.gz
volse-hubzilla-13970280d91f652d3634e543c027c9f80fab28e9.tar.bz2
volse-hubzilla-13970280d91f652d3634e543c027c9f80fab28e9.zip
Merge branch 'dev' of ../hz into dev
Diffstat (limited to 'Zotlabs/Module/Linkinfo.php')
-rw-r--r--Zotlabs/Module/Linkinfo.php45
1 files changed, 44 insertions, 1 deletions
diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php
index 32b4c0281..b9f90deec 100644
--- a/Zotlabs/Module/Linkinfo.php
+++ b/Zotlabs/Module/Linkinfo.php
@@ -69,6 +69,14 @@ class Linkinfo extends \Zotlabs\Web\Controller {
killme();
}
if(stripos($type,'video/') !== false) {
+ $thumb = self::get_video_poster($url);
+ if($thumb) {
+ if ($zrl)
+ echo $br . '[zvideo poster=\'' . $thumb . '\']' . $url . '[/zvideo]' . $br;
+ else
+ echo $br . '[video poster=\'' . $thumb . '\']' . $url . '[/video]' . $br;
+ killme();
+ }
if($zrl)
echo $br . '[zvideo]' . $url . '[/zvideo]' . $br;
else
@@ -216,7 +224,42 @@ class Linkinfo extends \Zotlabs\Web\Controller {
return($complete);
}
-
+
+ public static function get_video_poster($url) {
+
+ if(strpos($url,z_root() . '/cloud/') === false) {
+ return EMPTY_STR;
+ }
+ $m = parse_url($url,PHP_URL_PATH);
+ if($m) {
+ // strip leading '/cloud/'
+ $m = substr($m,7);
+ }
+ $nick = substr($m,0,strpos($m,'/'));
+ $p = substr($m,strpos($m,'/')+1);
+
+ // get the channel to check permissions
+
+ $u = channelx_by_nick($nick);
+
+ if($u && $p) {
+
+ $sql_extra = permissions_sql(intval($u['channel_id']));
+
+ $r = q("select hash, content from attach where display_path = '%s' and uid = %d and os_storage = 1 $sql_extra limit 1",
+ dbesc($p),
+ intval($u['channel_id'])
+ );
+ if($r) {
+ $path = dbunescbin($r[0]['content']);
+ if($path && @file_exists($path . '.thumb')) {
+ return z_root() . '/poster/' . $nick . '/' . $r[0]['hash'];
+ }
+ }
+ }
+ return EMPTY_STR;
+ }
+
public static function parseurl_getsiteinfo($url) {
$siteinfo = array();