Avatar type findAvatar()
This commit is contained in:
parent
19ddd37182
commit
02bc23c832
|
@ -11,6 +11,17 @@ function findFile($name){
|
|||
return $pathinfo;
|
||||
}
|
||||
|
||||
function findAvatar($name){
|
||||
$directory = base_path('/img');
|
||||
$files = scandir($directory);
|
||||
$pathinfo = "error.error";
|
||||
foreach($files as $file) {
|
||||
if (strpos($file, $name.'.') !== false) {
|
||||
$pathinfo = "/img/" . $name. "." . pathinfo($file, PATHINFO_EXTENSION);
|
||||
}}
|
||||
return $pathinfo;
|
||||
}
|
||||
|
||||
function findBackground($name){
|
||||
$directory = base_path('/img/background-img/');
|
||||
$files = scandir($directory);
|
||||
|
|
|
@ -283,10 +283,8 @@ function get_operating_system() {
|
|||
<div class="row">
|
||||
<div class="column" style="margin-top: 5%">
|
||||
<!-- Your Image Here -->
|
||||
@if(file_exists(base_path("img/" . $userinfo->id . ".png")))
|
||||
<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')))
|
||||
<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;">
|
||||
@if(file_exists(base_path(findAvatar($userinfo->id))))
|
||||
<img alt="avatar" class="rounded-avatar fadein" src="{{ url(findAvatar($userinfo->id)) }}" srcset="{{ asset('littlelink/images/avatar@2x.png 2x') }}" width="128px" height="128px" style="object-fit: cover;">
|
||||
@else
|
||||
<img alt="avatar" class="rounded-avatar fadein" src="{{ asset('littlelink/images/logo.svg') }}" srcset="{{ asset('littlelink/images/avatar@2x.png 2x') }}" width="128px" height="128px" style="object-fit: cover;">
|
||||
@endif
|
||||
|
|
Loading…
Reference in New Issue