mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 10:10:48 +01:00
feat: Add support for uncentered champion images
- Updated the Champion model to include an optional parameter for retrieving uncentered champion images. Adjusted image URLs in relevant views accordingly.
This commit is contained in:
@@ -37,7 +37,7 @@ class ChampionController extends Controller
|
||||
$splashColor = Cache::remember(
|
||||
'championSplashColorCache'.$champion->slug,
|
||||
$sixMonthsInSeconds,
|
||||
static fn () => getAverageColorFromImageUrl('https://wsrv.nl/?url='.$champion->getChampionImageAttribute())
|
||||
static fn () => getAverageColorFromImageUrl('https://wsrv.nl/?url=' . $champion->getChampionImageAttribute(true))
|
||||
);
|
||||
|
||||
$champion->splash_color = $splashColor;
|
||||
|
||||
@@ -99,9 +99,13 @@ class Champion extends Model
|
||||
return $this->hasMany(Streamer::class, 'champion_id', 'champion_id');
|
||||
}
|
||||
|
||||
public function getChampionImageAttribute(): string
|
||||
public function getChampionImageAttribute(bool $uncentered = false): string
|
||||
{
|
||||
return 'https://raw.communitydragon.org/pbe/plugins/rcp-be-lol-game-data/global/default/v1/champion-splashes/'.$this->champion_id.'/'.$this->champion_id.'000.jpg';
|
||||
$baseUrl = 'https://raw.communitydragon.org/pbe/plugins/rcp-be-lol-game-data/global/default/v1/champion-splashes/';
|
||||
$imagePath = $uncentered ? 'uncentered/' : '';
|
||||
$imageUrl = $baseUrl . $imagePath . $this->champion_id . '/' . $this->champion_id . '000.jpg';
|
||||
|
||||
return $imageUrl;
|
||||
}
|
||||
|
||||
public function getChampionImageTileAttribute(): string
|
||||
|
||||
Reference in New Issue
Block a user