Merge pull request #317 from JulianPrieber/image-id

Changed profile picture save method to use user id
This commit is contained in:
Julian Prieber 2023-02-02 18:07:16 +01:00 committed by GitHub
commit 369965f55f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -526,7 +526,7 @@ class UserController extends Controller
User::where('id', $userId)->update(['littlelink_name' => $pageName, 'littlelink_description' => $pageDescription, 'name' => $name]); User::where('id', $userId)->update(['littlelink_name' => $pageName, 'littlelink_description' => $pageDescription, 'name' => $name]);
if ($request->hasFile('image')) { if ($request->hasFile('image')) {
$profilePhoto->move(base_path('/img'), $littlelink_name . ".png"); $profilePhoto->move(base_path('/img'), $userId . ".png");
} }
return Redirect('/studio/page'); return Redirect('/studio/page');

View File

@ -250,8 +250,8 @@ function get_operating_system() {
<div class="row"> <div class="row">
<div class="column" style="margin-top: 5%"> <div class="column" style="margin-top: 5%">
<!-- Your Image Here --> <!-- Your Image Here -->
@if(file_exists(base_path("img/$littlelink_name" . ".png" ))) @if(file_exists(base_path("img/" . $userinfo->id . ".png")))
<img alt="avatar" class="rounded-avatar fadein" src="{{ asset("img/$littlelink_name" . ".png") }}" width="128px" height="128px" style="object-fit: cover;"> <img alt="avatar" class="rounded-avatar fadein" src="{{ asset("img/" . $userinfo->id . ".png") }}" width="128px" height="128px" style="object-fit: cover;">
@elseif(file_exists(base_path("littlelink/images/").findFile('avatar'))) @elseif(file_exists(base_path("littlelink/images/").findFile('avatar')))
<img alt="avatar" class="rounded-avatar fadein" src="{{ asset('littlelink/images/'.findFile('avatar')) }}" srcset="{{ asset('littlelink/images/avatar@2x.png 2x') }}" width="128px" height="128px" style="object-fit: cover;"> <img alt="avatar" class="rounded-avatar fadein" src="{{ asset('littlelink/images/'.findFile('avatar')) }}" srcset="{{ asset('littlelink/images/avatar@2x.png 2x') }}" width="128px" height="128px" style="object-fit: cover;">
@else @else

View File

@ -28,8 +28,8 @@
</div> </div>
<div class="form-group col-lg-8"> <div class="form-group col-lg-8">
@if(file_exists(base_path("img/$user->littlelink_name" . ".png" ))) @if(file_exists(base_path("img/" . $user->id . ".png")))
<img src="{{ asset("img/$user->littlelink_name" . ".png") }}" srcset="{{ asset("img/$user->littlelink_name" . "@2x.png 2x") }}" width="128px" height="128px" style="object-fit: cover;"> <img src="{{ asset("img/" . $user->id . ".png") }}" srcset="{{ asset("img/$user->littlelink_name" . "@2x.png 2x") }}" width="128px" height="128px" style="object-fit: cover;">
@elseif(file_exists(base_path("littlelink/images/").findFile('avatar'))) @elseif(file_exists(base_path("littlelink/images/").findFile('avatar')))
<img class="rounded-avatar" src="{{ asset('littlelink/images/'.findFile('avatar')) }}" srcset="{{ asset('littlelink/images/avatar@2x.png 2x') }}" width="128px" height="128px" style="object-fit: cover;"> <img class="rounded-avatar" src="{{ asset('littlelink/images/'.findFile('avatar')) }}" srcset="{{ asset('littlelink/images/avatar@2x.png 2x') }}" width="128px" height="128px" style="object-fit: cover;">
@else @else

View File

@ -32,8 +32,8 @@
@endif @endif
<div class="form-group col-lg-8"> <div class="form-group col-lg-8">
@if(file_exists(base_path("img/$page->littlelink_name" . ".png" ))) @if(file_exists(base_path("img/" . Auth::user()->id . ".png")))
<img src="{{ asset("img/$page->littlelink_name" . ".png") }}" style="width: 75px; height: 75px; border-radius: 50%; object-fit: cover;"> <img src="{{ asset("img/" . Auth::user()->id . ".png") }}" style="width: 75px; height: 75px; border-radius: 50%; object-fit: cover;">
@else @else
@if(!empty($page->image)) @if(!empty($page->image))
<img src="{{ $page->image }}" style="width: 75px; height: 75px; object-fit: cover;"> <img src="{{ $page->image }}" style="width: 75px; height: 75px; object-fit: cover;">