nojs layout
This commit is contained in:
@@ -111,7 +111,7 @@ class UserController extends Controller
|
||||
\Session::flash('info', 'Cannot register when logged in');
|
||||
return redirect('/');
|
||||
}
|
||||
return view('register');
|
||||
return view('apply');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,7 +125,7 @@ class UserController extends Controller
|
||||
if(auth()->check()) return redirect()->back()->with('info', 'Cannot register when logged in');
|
||||
$validator = \Validator::make($request->all(), [
|
||||
'username' => 'required|unique:users|min:3|max:25|alpha_num',
|
||||
//'email' => 'required|email|unique:users|confirmed',
|
||||
'email' => 'required|email|unique:users|confirmed',
|
||||
'password' => 'required|min:6|confirmed',
|
||||
'g-recaptcha-response' => 'required|recaptcha'
|
||||
]);
|
||||
@@ -139,23 +139,23 @@ class UserController extends Controller
|
||||
|
||||
$user = new User();
|
||||
$user->username = $request->get('username');
|
||||
$user->email = ""; //$request->get('email');
|
||||
$user->email = $request->get('email');
|
||||
$user->password = $request->get('password');
|
||||
$user->activation_token = ""; //$activation_token;
|
||||
$user->activation_token = $activation_token;
|
||||
$user->disabled = 0;
|
||||
$user->verified = 1;
|
||||
$user->categories = [];
|
||||
if($user->save()) {
|
||||
/*$data = [
|
||||
$data = [
|
||||
'username' => $user->username,
|
||||
'activation_token' => $activation_token
|
||||
];*/
|
||||
];
|
||||
|
||||
// Send Mail
|
||||
|
||||
/*\Mail::queue('emails.activation', $data, function($message) use ($user) {
|
||||
\Mail::queue('emails.activation', $data, function($message) use ($user) {
|
||||
$message->to($user->email, $user->username)->subject('Welcome to w0bm. Activate your account');
|
||||
});*/
|
||||
});
|
||||
|
||||
return redirect('/')->with('info', 'Congratulations! You can now login!');
|
||||
} else {
|
||||
|
@@ -120,6 +120,7 @@ class VideoController extends Controller
|
||||
|
||||
// TODO: outsource to different process (async)
|
||||
$video->createThumbnail();
|
||||
$video->tesThumb();
|
||||
|
||||
// Discord
|
||||
if (config('discord.enabled') && config('discord.webhookurl')) {
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 616 KiB |
@@ -20,6 +20,7 @@ Route::get('/', ['as' => 'home', function () {
|
||||
|
||||
}])->middleware('auth');
|
||||
|
||||
Route::post('nojs', 'UserController@nojs');
|
||||
|
||||
Route::post('filter', 'UserController@filter');
|
||||
|
||||
|
@@ -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