1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-14 10:34:23 +02:00

Issue #3200 More work on Media-picker. Version changed to 2.1.9 (git)

This commit is contained in:
Cameron
2018-07-18 14:40:29 -07:00
parent 4264dc6f66
commit 6ab8c5c0f3
7 changed files with 252 additions and 20 deletions

View File

@@ -4624,6 +4624,27 @@ class e_parser
return ($ext === 'jpg' || $ext === 'png' || $ext === 'gif' || $ext === 'jpeg') ? true : false;
}
/**
* @param $file
* @param array $parm
* @return string
*/
public function toAudio($file, $parm=array())
{
$file = $this->replaceConstants($file, 'abs');
$text = '<audio controls style="max-width:100%">
<source src="'.$file.'" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>';
return $text;
}
/**
* Display a Video file.
@@ -4640,6 +4661,8 @@ class e_parser
list($id,$type) = explode(".",$file,2);
$thumb = vartrue($parm['thumb']);
$mode = varset($parm['mode'],false); // tag, url
$pref = e107::getPref();
@@ -4670,6 +4693,13 @@ class e_parser
// $thumbSrc = "https://i1.ytimg.com/vi/".$id."/0.jpg";
$thumbSrc = "https://i1.ytimg.com/vi/".$id."/mqdefault.jpg";
$video = '<iframe class="embed-responsive-item" width="560" height="315" src="//www.youtube.com/embed/'.$id.'?'.$ytqry.'" style="background-size: 100%;background-image: url('.$thumbSrc.');border:0px" allowfullscreen></iframe>';
$url = 'http://youtu.be/'.$id;
if($mode === 'url')
{
return $url;
}
if($thumb === 'tag')
@@ -4682,7 +4712,7 @@ class e_parser
$thumbSrc = "http://i1.ytimg.com/vi/".$id."/maxresdefault.jpg"; // 640 x 480
$filename = 'temp/yt-thumb-'.md5($id).".jpg";
$filepath = e_MEDIA.$filename;
$url = 'http://youtu.be/'.$id;
if(!file_exists($filepath))
{
@@ -4742,11 +4772,22 @@ class e_parser
return '<div class="'.$defClass.' '.vartrue($parm['class']).'">'.$video.'</div>';
}
if($type === 'mp4') //TODO FIXME
if($type === 'mp4')
{
$file = $this->replaceConstants($file, 'abs');
if($mode === 'url')
{
return $file;
}
$width = varset($parm['w'], 320);
$height = varset($parm['h'], 240);
return '
<div class="video-responsive">
<video width="320" height="240" controls>
<video width="'.$width.'" height="'.$height.'" controls>
<source src="'.$file.'" type="video/mp4">
Your browser does not support the video tag.