nojs layout
This commit is contained in:
@@ -160,6 +160,56 @@ class Video extends Model
|
||||
}
|
||||
}
|
||||
|
||||
public function tesThumb() {
|
||||
set_time_limit(9899999999999999);
|
||||
$dat = $this->file;
|
||||
#$in = public_path() . "/b"; // webm-input
|
||||
$in = "/home/sirx/web/devw0bm/w0bm.com/public/b";
|
||||
$out = public_path() . "/thumbs/beta"; //thumb-output
|
||||
$tmpdir = str_replace("public", "app/Http/Controllers/tmp", public_path());
|
||||
|
||||
$name = explode(".", $dat);
|
||||
array_pop($name);
|
||||
$name = join(".", $name);
|
||||
|
||||
#$ffmpegthumbnailer = round(shell_exec("ffmpegthumbnailer -i {$in}/{$dat} -a -o {$out}/{$name}_test.png"));
|
||||
//$ffmpeg = round(shell_exec("ffmpeg -i {$in}/{$dat} -vf select='eq(pict_type,PICT_TYPE_I)' -vf scale=128:128 {$out}/{$name}_ffmpeg.png"));
|
||||
$length = round(shell_exec("ffprobe -i {$in}/{$dat} -show_format -v quiet | sed -n 's/duration=//p'"));
|
||||
$half = $length / 20;
|
||||
$ffmpeg = exec("ffmpegthumbnailer -i {$in}/{$dat} -o {$out}/{$name}_test.png", $output, $return);
|
||||
if ($return != 0) {
|
||||
// error
|
||||
@unlink("{$out}/{$name}_test.png");
|
||||
exec("ffmpeg -i {$in}/{$dat} -vf select='eq(pict_type,PICT_TYPE_I)' -vf scale=128:128:force_original_aspect_ratio=increase,crop=128:128 {$out}/{$name}.png");
|
||||
}else{
|
||||
// success
|
||||
@unlink("{$out}/{$name}_test.png");
|
||||
exec("ffmpeg -i {$in}/{$dat} -vf select='eq(pict_type,PICT_TYPE_I)' -vf scale=128:128:force_original_aspect_ratio=increase,crop=128:128 -ss {$half} {$out}/{$name}.png");
|
||||
}
|
||||
}
|
||||
|
||||
public function createThumbnailStatic() {
|
||||
$dat = $this->file;
|
||||
$in = public_path() . "/b"; // webm-input
|
||||
$out = public_path() . "/thumbs/testing"; //thumb-output
|
||||
$tmpdir = str_replace("public", "app/Http/Controllers/tmp", public_path());
|
||||
|
||||
$name = explode(".", $dat);
|
||||
array_pop($name);
|
||||
$name = join(".", $name);
|
||||
if(!file_exists("{$out}/{$name}.png")) {
|
||||
$length = round(shell_exec("ffprobe -i {$in}/{$dat} -show_format -v quiet | sed -n 's/duration=//p'"));
|
||||
for ($i = 1; $i < 10; $i++) {
|
||||
$act = ($i * 10) * ($length / 100);
|
||||
$ffmpeg = shell_exec("ffmpeg -ss {$act} -i {$in}/{$dat} -vf \"'select=eq(n\,0)'\" -vf scale=128:128 {$tmpdir}/{$name}_{$i}.png 2>&1");
|
||||
}
|
||||
$tmp = shell_exec("convert -delay 27 -loop 0 {$tmpdir}/{$name}_*.png {$out}/{$name}.png 2>&1");
|
||||
if(@filesize("{$out}/{$name}.png") < 2000)
|
||||
@unlink("{$out}/{$name}.png");
|
||||
array_map('unlink', glob("{$tmpdir}/{$name}*.png"));
|
||||
}
|
||||
}
|
||||
|
||||
public static function getRandom($related = null) {
|
||||
if ($related) {
|
||||
$id = $related->videos()->filtered()->countScoped()->count() - 1;
|
||||
|
Reference in New Issue
Block a user