Skip to content

Commit

Permalink
update admin profile image
Browse files Browse the repository at this point in the history
  • Loading branch information
AjayYadavAi committed May 1, 2022
1 parent ea38689 commit 0a0b89c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion app/Traits/UploadImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ trait uploadImage{
function saveImage($image, $path = 'images')
{
$imageName = time().'_'.$image->getClientOriginalName();
$image->storeAs($path,$imageName,'public');

$image->move(public_path($path), $imageName);

// $image->storeAs($path,$imageName,'public');
return $imageName;
}
}
Binary file added public/images/1651389508_user.avif
Binary file not shown.
Binary file added public/images/user.avif
Binary file not shown.
2 changes: 1 addition & 1 deletion resources/views/layouts/header.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<button @click="dropdownOpen = ! dropdownOpen"
class="relative block h-8 w-8 rounded-full overflow-hidden shadow focus:outline-none">
<img class="h-full w-full object-cover"
src="/storage/images/{{ auth()->user()->profile }}"
src="/images/{{ auth()->user()->profile }}"
alt="Your avatar">
</button>

Expand Down
2 changes: 1 addition & 1 deletion resources/views/setting/profile.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class="hidden thumbnailprev" @change="updatePreview()">
function imageData() {
var files = document.getElementById("thumbnailprev").files;
if(files.length == 0){
var url = '/storage/images/'+{!! json_encode($user->profile) !!};
var url = '/images/'+{!! json_encode($user->profile) !!};
}else{
url = '';
}
Expand Down

0 comments on commit 0a0b89c

Please sign in to comment.