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(
|
$splashColor = Cache::remember(
|
||||||
'championSplashColorCache'.$champion->slug,
|
'championSplashColorCache'.$champion->slug,
|
||||||
$sixMonthsInSeconds,
|
$sixMonthsInSeconds,
|
||||||
static fn () => getAverageColorFromImageUrl('https://wsrv.nl/?url='.$champion->getChampionImageAttribute())
|
static fn () => getAverageColorFromImageUrl('https://wsrv.nl/?url=' . $champion->getChampionImageAttribute(true))
|
||||||
);
|
);
|
||||||
|
|
||||||
$champion->splash_color = $splashColor;
|
$champion->splash_color = $splashColor;
|
||||||
|
|||||||
@@ -99,9 +99,13 @@ class Champion extends Model
|
|||||||
return $this->hasMany(Streamer::class, 'champion_id', 'champion_id');
|
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
|
public function getChampionImageTileAttribute(): string
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<div class="absolute inset-0 aspect-video glow-shadow rounded-2xl"
|
<div class="absolute inset-0 aspect-video glow-shadow rounded-2xl"
|
||||||
style="--splash-color: {{ $champion->splash_color }}"></div>
|
style="--splash-color: {{ $champion->splash_color }}"></div>
|
||||||
<div class="relative overflow-hidden aspect-video rounded-2xl">
|
<div class="relative overflow-hidden aspect-video rounded-2xl">
|
||||||
<img src="//wsrv.nl/?url={{ $champion->getChampionImageAttribute() }}&w=880&output=webp&q=85&il"
|
<img src="//wsrv.nl/?url={{ $champion->getChampionImageAttribute(true) }}&w=880&output=webp&q=85&il"
|
||||||
alt="{{ $champion->name }} Splash Art"
|
alt="{{ $champion->name }} Splash Art"
|
||||||
class="z-10 object-cover w-full h-full transition-transform duration-700 transform scale-100 hover:scale-105">
|
class="z-10 object-cover w-full h-full transition-transform duration-700 transform scale-100 hover:scale-105">
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<h3 class="mt-8 mb-2 text-2xl font-bold text-center text-transparent uppercase sm:text-3xl bg-gradient-to-bl from-orange-300 to-orange-500 bg-clip-text">Champions on Sale</h3>
|
<h3 class="mt-8 mb-2 text-2xl font-bold text-center text-transparent uppercase sm:text-3xl bg-gradient-to-bl from-orange-300 to-orange-500 bg-clip-text">Champions on Sale</h3>
|
||||||
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
<div class="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
|
||||||
@foreach($sales['CHAMPION'] as $sale)
|
@foreach($sales['CHAMPION'] as $sale)
|
||||||
@php
|
@php
|
||||||
$champion = Champion::where('champion_id', $sale['id'])->first();
|
$champion = Champion::where('champion_id', $sale['id'])->first();
|
||||||
@@ -21,12 +21,12 @@
|
|||||||
@endphp
|
@endphp
|
||||||
<a href="/champion/{{$champion->slug}}">
|
<a href="/champion/{{$champion->slug}}">
|
||||||
<div
|
<div
|
||||||
class="flex flex-col text-gray-700 bg-stone-800/40 shadow-md rounded-2xl bg-clip-border border border-stone-800 hover:border-orange-500/10 hover:shadow-orange-500/10 items-center">
|
class="flex flex-col items-center text-gray-700 border shadow-md bg-stone-800/40 rounded-2xl bg-clip-border border-stone-800 hover:border-orange-500/10 hover:shadow-orange-500/10">
|
||||||
<div class="absolute mt-4 rounded-full bg-black/60 px-3 py-1 text-white">
|
<div class="absolute px-3 py-1 mt-4 text-white rounded-full bg-black/60">
|
||||||
{{ $discountPercentage }}% Off
|
{{ $discountPercentage }}% Off
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="mx-4 overflow-hidden w-auto rounded-2xl bg-clip-border border-2 border-orange-400/40 mt-3 aspect-video">
|
class="w-auto mx-4 mt-3 overflow-hidden border-2 rounded-2xl bg-clip-border border-orange-400/40 aspect-video">
|
||||||
<img
|
<img
|
||||||
src="//wsrv.nl/?url={{ $champion->getChampionImageAttribute() }}&w=450&output=webp&q=80&il&default=ssl:wsrv.nl%2F%3Furl%3Dhttps://i.ibb.co/5s6YyvN/aaaa.png"
|
src="//wsrv.nl/?url={{ $champion->getChampionImageAttribute() }}&w=450&output=webp&q=80&il&default=ssl:wsrv.nl%2F%3Furl%3Dhttps://i.ibb.co/5s6YyvN/aaaa.png"
|
||||||
class="aspect-video"
|
class="aspect-video"
|
||||||
@@ -36,8 +36,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="px-4 py-2">
|
<div class="px-4 py-2">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<p class="block text-sm antialiased font-medium text-gray-100 text-left">
|
<p class="block text-sm antialiased font-medium text-left text-gray-100">
|
||||||
<span class="text-orange-400 font-bold">{{ $champion->name }}</span> •
|
<span class="font-bold text-orange-400">{{ $champion->name }}</span> •
|
||||||
{{ $discountedPrice }} RP
|
{{ $discountedPrice }} RP
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -48,9 +48,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<h3 class="text-2xl font-bold text-center text-transparent uppercase sm:text-3xl bg-gradient-to-bl from-orange-300 to-orange-500 bg-clip-text mt-8">Skins on Sale</h3>
|
<h3 class="mt-8 text-2xl font-bold text-center text-transparent uppercase sm:text-3xl bg-gradient-to-bl from-orange-300 to-orange-500 bg-clip-text">Skins on Sale</h3>
|
||||||
<div class="container mx-auto p-4 flex items-center justify-center flex-col text-white">
|
<div class="container flex flex-col items-center justify-center p-4 mx-auto text-white">
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
<div class="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
|
||||||
@foreach($sales['CHAMPION_SKIN'] as $sale)
|
@foreach($sales['CHAMPION_SKIN'] as $sale)
|
||||||
@php
|
@php
|
||||||
$skin = ChampionSkin::where('full_skin_id', $sale['id'])->first();
|
$skin = ChampionSkin::where('full_skin_id', $sale['id'])->first();
|
||||||
@@ -60,12 +60,12 @@
|
|||||||
@endphp
|
@endphp
|
||||||
<a href="/skin/{{ $skin->slug }}">
|
<a href="/skin/{{ $skin->slug }}">
|
||||||
<div
|
<div
|
||||||
class="flex flex-col text-gray-700 bg-stone-800/40 shadow-md rounded-2xl bg-clip-border border border-stone-800 hover:border-orange-500/10 hover:shadow-orange-500/10 items-center">
|
class="flex flex-col items-center text-gray-700 border shadow-md bg-stone-800/40 rounded-2xl bg-clip-border border-stone-800 hover:border-orange-500/10 hover:shadow-orange-500/10">
|
||||||
<div class="absolute mt-4 rounded-full bg-black/60 px-3 py-1 text-white">
|
<div class="absolute px-3 py-1 mt-4 text-white rounded-full bg-black/60">
|
||||||
{{ $discountPercentage }}% Off
|
{{ $discountPercentage }}% Off
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="mx-4 overflow-hidden w-auto rounded-2xl bg-clip-border border-2 border-orange-400/40 mt-3 aspect-video">
|
class="w-auto mx-4 mt-3 overflow-hidden border-2 rounded-2xl bg-clip-border border-orange-400/40 aspect-video">
|
||||||
<img
|
<img
|
||||||
src="//wsrv.nl/?url={{ $skin->getSkinImageAttribute() }}&w=450&output=webp&q=80&il&default=ssl:wsrv.nl%2F%3Furl%3Dhttps://i.ibb.co/5s6YyvN/aaaa.png"
|
src="//wsrv.nl/?url={{ $skin->getSkinImageAttribute() }}&w=450&output=webp&q=80&il&default=ssl:wsrv.nl%2F%3Furl%3Dhttps://i.ibb.co/5s6YyvN/aaaa.png"
|
||||||
class="aspect-video"
|
class="aspect-video"
|
||||||
@@ -75,8 +75,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="px-4 py-2">
|
<div class="px-4 py-2">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<p class="block text-sm antialiased font-medium text-gray-100 text-left">
|
<p class="block text-sm antialiased font-medium text-left text-gray-100">
|
||||||
<span class="text-orange-400 font-bold">{{ $skin->skin_name }}</span> •
|
<span class="font-bold text-orange-400">{{ $skin->skin_name }}</span> •
|
||||||
{{ $discountedPrice }} RP
|
{{ $discountedPrice }} RP
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user