fix thumbnail generation
fix hardcoded paths a lot of minor fixes
This commit is contained in:
@@ -163,8 +163,8 @@ class Video extends Model
|
||||
public function tesThumb() {
|
||||
set_time_limit(9899999999999999);
|
||||
$dat = $this->file;
|
||||
#$in = public_path() . "/b"; // webm-input
|
||||
$in = "/home/w0bm/w0bm/public/b";
|
||||
$in = public_path() . "/b"; // webm-input
|
||||
#$in = "/home/w0bm/w0bm/public/b";
|
||||
$out = public_path() . "/thumbs/beta"; //thumb-output
|
||||
$tmpdir = str_replace("public", "app/Http/Controllers/tmp", public_path());
|
||||
|
||||
@@ -192,7 +192,7 @@ public function blurryThumb() {
|
||||
set_time_limit(9899999999999999);
|
||||
$dat = $this->file;
|
||||
#$in = public_path() . "/b"; // webm-input
|
||||
$in = "/home/w0bm/w0bm/public/b";
|
||||
$in = public_path() . "/b";
|
||||
$out = public_path() . "/thumbs/blurred"; //thumb-output
|
||||
$tmpdir = str_replace("public", "app/Http/Controllers/tmp", public_path());
|
||||
|
||||
@@ -220,28 +220,6 @@ public function blurryThumb() {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -260,8 +238,8 @@ public function blurryThumb() {
|
||||
}
|
||||
|
||||
public function isSfw() {
|
||||
return $this->tags->contains(function ($key, $tag) {
|
||||
$tag->normalized === 'sfw';
|
||||
return !$this->tags->contains(function ($key, $tag) {
|
||||
return $tag->normalized === 'nsfw';
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user