Skip to content

Commit

Permalink
url for pictures
Browse files Browse the repository at this point in the history
  • Loading branch information
Javdu10 committed Oct 18, 2021
1 parent 0c37cb7 commit cb844b6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"name": "flyff",
"description": "Plugin for Azuriom",
"version": "0.2.7",
"url": "https://azuriom.com",
"url": "https:\/\/azuriom.com",
"authors": [
"Javdu10"
],
"providers": [
"\\Azuriom\\Plugin\\Flyff\\Providers\\FlyffServiceProvider",
"\\Azuriom\\Plugin\\Flyff\\Providers\\RouteServiceProvider"
],
"apiId":35,
"installRedirectPath": "install/flyff"
}
"apiId": 35,
"installRedirectPath": "install\/flyff"
}
11 changes: 6 additions & 5 deletions src/Games/FlyffGame.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ public function name()
{
return 'Flyff';
}
public function id(){ return 'flyff';}
public function id()
{
return 'flyff';
}

public function getAvatarUrl(User $user, int $size = 64)
{
$files = Storage::files("public/flyff/avatars/{$user->id}");
if (count($files) > 0) {
$url = Storage::url(Arr::random($files));
return url(Storage::url(Arr::random($files)));
} else {
$url = plugin_asset('flyff', 'img/unknown_avatar.png');
return plugin_asset('flyff', 'img/unknown_avatar.png');
}

return $url;
}

public function getUserUniqueId(string $name)
Expand Down
2 changes: 1 addition & 1 deletion src/Models/FlyffCharacter.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public function getTotalTimePlayedAttribute(): string
public function getAvatarUrlAttribute()
{
if (!is_null($this->flyffAccount) && Storage::exists("public/flyff/avatars/{$this->flyffAccount->Azuriom_user_id}/{$this->m_szName}.png")) {
return Storage::url("public/flyff/avatars/{$this->flyffAccount->Azuriom_user_id}/{$this->m_szName}.png");
return url(Storage::url("public/flyff/avatars/{$this->flyffAccount->Azuriom_user_id}/{$this->m_szName}.png"));
}

return plugin_asset('flyff', 'img/unknown_avatar.png');
Expand Down

0 comments on commit cb844b6

Please sign in to comment.