mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 21:57:51 +02:00
Fixes #5396 toVideo dimensions.
This commit is contained in:
@@ -5112,6 +5112,11 @@ class e_parse
|
|||||||
$height = varset($parm['h'], 240);
|
$height = varset($parm['h'], 240);
|
||||||
$mime = varset($parm['mime'], 'video/mp4');
|
$mime = varset($parm['mime'], 'video/mp4');
|
||||||
|
|
||||||
|
if($height === 0)
|
||||||
|
{
|
||||||
|
$height = 'auto';
|
||||||
|
}
|
||||||
|
|
||||||
return '
|
return '
|
||||||
<div class="video-responsive">
|
<div class="video-responsive">
|
||||||
<video width="' . $width . '" height="' . $height . '" controls>
|
<video width="' . $width . '" height="' . $height . '" controls>
|
||||||
|
@@ -1267,7 +1267,8 @@ class e_media
|
|||||||
{
|
{
|
||||||
|
|
||||||
case "video":
|
case "video":
|
||||||
$preview = $tp->toVideo($default, array('w'=>$width, 'h'=> ($height - 50)));
|
$h = (!is_numeric($height) || $height < 1) ? 0 : ($height - 50);
|
||||||
|
$preview = $tp->toVideo($default, array('w'=>$width, 'h'=>$h ));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "audio":
|
case "audio":
|
||||||
|
@@ -2680,11 +2680,43 @@ Your browser does not support the audio tag.
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
public function testToVideo()
|
public function testToVideo()
|
||||||
{
|
{
|
||||||
|
$tests = [
|
||||||
|
0 => [
|
||||||
|
'file' => '{e_MEDIA}myfile.mp4',
|
||||||
|
'parms' =>[],
|
||||||
|
'expected' => '<video width="320" height="240" controls>'
|
||||||
|
],
|
||||||
|
|
||||||
}*/
|
1 => [
|
||||||
|
'file' => '{e_MEDIA}myfile.mp4',
|
||||||
|
'parms' =>['w'=>500],
|
||||||
|
'expected' => '<video width="500" height="240" controls>'
|
||||||
|
],
|
||||||
|
|
||||||
|
2 => [
|
||||||
|
'file' => '{e_MEDIA}myfile.mp4',
|
||||||
|
'parms' =>['w'=>300, 'h'=>0],
|
||||||
|
'expected' => '<video width="300" height="auto" controls>'
|
||||||
|
],
|
||||||
|
|
||||||
|
3 => [
|
||||||
|
'file' => '{e_MEDIA}myfile.mp4',
|
||||||
|
'parms' =>['w'=>300, 'h'=>'auto'],
|
||||||
|
'expected' => '<video width="300" height="auto" controls>'
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($tests as $index => $var)
|
||||||
|
{
|
||||||
|
$result = $this->tp->toVideo($var['file'], $var['parms']);
|
||||||
|
self::assertStringContainsString($var['expected'], $result, 'Failed on index #'.$index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function testMakeClickable()
|
public function testMakeClickable()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user