Skip to content

Commit 5b23fa0

Browse files
committed
Changed profile picture save method to use user id
Changed profile picture to use user id instead of username to save it. If merged, this will reset all current profile pictures on the instance.
1 parent c0c4397 commit 5b23fa0

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

app/Http/Controllers/UserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ public function editPage(request $request)
526526
User::where('id', $userId)->update(['littlelink_name' => $pageName, 'littlelink_description' => $pageDescription, 'name' => $name]);
527527

528528
if ($request->hasFile('image')) {
529-
$profilePhoto->move(base_path('/img'), $littlelink_name . ".png");
529+
$profilePhoto->move(base_path('/img'), $userId . ".png");
530530
}
531531

532532
return Redirect('/studio/page');

resources/views/littlelink.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ function get_operating_system() {
250250
<div class="row">
251251
<div class="column" style="margin-top: 5%">
252252
<!-- Your Image Here -->
253-
@if(file_exists(base_path("img/$littlelink_name" . ".png" )))
254-
<img alt="avatar" class="rounded-avatar fadein" src="{{ asset("img/$littlelink_name" . ".png") }}" width="128px" height="128px" style="object-fit: cover;">
253+
@if(file_exists(base_path("img/" . $userinfo->id . ".png")))
254+
<img alt="avatar" class="rounded-avatar fadein" src="{{ asset("img/" . $userinfo->id . ".png") }}" width="128px" height="128px" style="object-fit: cover;">
255255
@elseif(file_exists(base_path("littlelink/images/").findFile('avatar')))
256256
<img alt="avatar" class="rounded-avatar fadein" src="{{ asset('littlelink/images/'.findFile('avatar')) }}" srcset="{{ asset('littlelink/images/[email protected] 2x') }}" width="128px" height="128px" style="object-fit: cover;">
257257
@else

resources/views/panel/edit-user.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
</div>
2929

3030
<div class="form-group col-lg-8">
31-
@if(file_exists(base_path("img/$user->littlelink_name" . ".png" )))
32-
<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;">
31+
@if(file_exists(base_path("img/" . $user->id . ".png")))
32+
<img src="{{ asset("img/" . $user->id . ".png") }}" srcset="{{ asset("img/$user->littlelink_name" . "@2x.png 2x") }}" width="128px" height="128px" style="object-fit: cover;">
3333
@elseif(file_exists(base_path("littlelink/images/").findFile('avatar')))
3434
<img class="rounded-avatar" src="{{ asset('littlelink/images/'.findFile('avatar')) }}" srcset="{{ asset('littlelink/images/[email protected] 2x') }}" width="128px" height="128px" style="object-fit: cover;">
3535
@else

resources/views/studio/page.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
@endif
3333

3434
<div class="form-group col-lg-8">
35-
@if(file_exists(base_path("img/$page->littlelink_name" . ".png" )))
36-
<img src="{{ asset("img/$page->littlelink_name" . ".png") }}" style="width: 75px; height: 75px; border-radius: 50%; object-fit: cover;">
35+
@if(file_exists(base_path("img/" . Auth::user()->id . ".png")))
36+
<img src="{{ asset("img/" . Auth::user()->id . ".png") }}" style="width: 75px; height: 75px; border-radius: 50%; object-fit: cover;">
3737
@else
3838
@if(!empty($page->image))
3939
<img src="{{ $page->image }}" style="width: 75px; height: 75px; object-fit: cover;">
@@ -58,15 +58,15 @@
5858
<div class="input-group-prepend">
5959
<div class="input-group-text">{{ url('') }}/@</div>
6060
</div>
61-
<input type="text" class="form-control" name="pageName" value="{{ $page->littlelink_name ?? '' }}" required>
61+
<input type="text" class="form-control" name="littlelink_name" value="{{ $page->littlelink_name ?? '' }}" required>
6262
</div>
6363

6464
<label style="margin-top:15px">Display name</label>
6565
<div class="input-group">
6666
{{-- <div class="input-group-prepend">
6767
<div class="input-group-text">Name:</div>
6868
</div> --}}
69-
<input type="text" class="form-control" name="Name" value="{{ $page->name }}" required>
69+
<input type="text" class="form-control" name="name" value="{{ $page->name }}" required>
7070
</div>
7171
</div>
7272

0 commit comments

Comments
 (0)