Added option to upload custom background image
This commit is contained in:
parent
6e5195730b
commit
fc73453872
|
@ -532,6 +532,22 @@ class UserController extends Controller
|
||||||
return Redirect('/studio/page');
|
return Redirect('/studio/page');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Upload custom theme background image
|
||||||
|
public function themeBackground(request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$userId = Auth::user()->id;
|
||||||
|
$littlelink_name = Auth::user()->littlelink_name;
|
||||||
|
|
||||||
|
$customBackground = $request->file('image');
|
||||||
|
|
||||||
|
if ($request->hasFile('image')) {
|
||||||
|
$customBackground->move(base_path('/img/background-img'), $userId . ".png");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Redirect('/studio/theme');
|
||||||
|
}
|
||||||
|
|
||||||
//Show custom theme
|
//Show custom theme
|
||||||
public function showTheme(request $request)
|
public function showTheme(request $request)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,6 +44,13 @@ return $path;}
|
||||||
<meta name="author" content="{{ $userinfo->name }}">
|
<meta name="author" content="{{ $userinfo->name }}">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
@endif
|
@endif
|
||||||
|
@if(file_exists(base_path('/img/background-img/'.$userinfo->id.'.png')))
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-image: url('{{url('/img/background-img/'.$userinfo->id.'.png')}}') !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@endif
|
||||||
|
|
||||||
<!--#### BEGIN Meta Tags social media preview images ####-->
|
<!--#### BEGIN Meta Tags social media preview images ####-->
|
||||||
<!-- This shows a preview for title, description and avatar image of users profiles if shared on social media sites -->
|
<!-- This shows a preview for title, description and avatar image of users profiles if shared on social media sites -->
|
||||||
|
|
|
@ -278,6 +278,27 @@ try{ if($GLOBALS['updateAv'] == true) echo '<img style="padding-left:40px; paddi
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
<br><br><br>
|
||||||
|
<form action="{{ route('themeBackground') }}" enctype="multipart/form-data" method="post">
|
||||||
|
@csrf
|
||||||
|
<h3>Custom background</h3>
|
||||||
|
<div style="display: none;" class="form-group col-lg-8">
|
||||||
|
<select class="form-control" name="theme">
|
||||||
|
<option>{{ $page->theme }}</option>
|
||||||
|
</select>
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-lg-8">
|
||||||
|
@if(!file_exists(base_path('/img/background-img/'.Auth::user()->id.'.png')))<p><i>No image selected</i></p>@endif
|
||||||
|
<img style="width:95%;max-width:400px;argin-left:1rem!important;border-radius:5px;" src="@if(file_exists(base_path('/img/background-img/'.Auth::user()->id.'.png'))){{url('/img/background-img/'.Auth::user()->id.'.png')}}@else{{url('/littlelink/images/themes/no-preview.png')}}@endif"><br><br>
|
||||||
|
<label>Upload background image</label>
|
||||||
|
<input type="file" accept="image/jpeg,image/jpg,image/png" class="form-control-file" name="image">
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<button type="submit" class="mt-3 ml-3 btn btn-secondary">Upload background</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
<br><br><br>
|
<br><br><br>
|
||||||
<form action="{{ route('editTheme') }}" enctype="multipart/form-data" method="post">
|
<form action="{{ route('editTheme') }}" enctype="multipart/form-data" method="post">
|
||||||
@csrf
|
@csrf
|
||||||
|
|
|
@ -115,6 +115,7 @@ Route::post('/studio/button-editor/{id}', [UserController::class, 'editCSS'])->n
|
||||||
Route::get('/studio/page', [UserController::class, 'showPage'])->name('showPage');
|
Route::get('/studio/page', [UserController::class, 'showPage'])->name('showPage');
|
||||||
Route::get('/studio/no_page_name', [UserController::class, 'showPage'])->name('showPage');
|
Route::get('/studio/no_page_name', [UserController::class, 'showPage'])->name('showPage');
|
||||||
Route::post('/studio/page', [UserController::class, 'editPage'])->name('editPage');
|
Route::post('/studio/page', [UserController::class, 'editPage'])->name('editPage');
|
||||||
|
Route::post('/studio/background', [UserController::class, 'themeBackground'])->name('themeBackground');
|
||||||
Route::get('/studio/profile', [UserController::class, 'showProfile'])->name('showProfile');
|
Route::get('/studio/profile', [UserController::class, 'showProfile'])->name('showProfile');
|
||||||
Route::post('/studio/profile', [UserController::class, 'editProfile'])->name('editProfile');
|
Route::post('/studio/profile', [UserController::class, 'editProfile'])->name('editProfile');
|
||||||
Route::post('/edit-icons', [UserController::class, 'editIcons'])->name('editIcons');
|
Route::post('/edit-icons', [UserController::class, 'editIcons'])->name('editIcons');
|
||||||
|
|
Loading…
Reference in New Issue