mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 18:20:48 +01:00
fix: Handle exceptions in image processing functions
- Catch exceptions when reading image content to prevent errors. - Adjust image resizing dimensions for better display.
This commit is contained in:
@@ -30,14 +30,14 @@ class ChampionController extends Controller
|
||||
$threeDaysInSeconds = 60 * 60 * 24 * 3;
|
||||
$sixMonthsInSeconds = 60 * 60 * 24 * 30 * 6;
|
||||
|
||||
$champion = Cache::remember('championShowCache'.$champion->slug, $threeDaysInSeconds, static fn () => $champion->load('streamers', 'skins', 'lanes'));
|
||||
$champion = Cache::remember('championShowCache' . $champion->slug, $threeDaysInSeconds, static fn () => $champion->load('streamers', 'skins', 'lanes'));
|
||||
|
||||
$streamers = $champion->load('streamers')->streamers;
|
||||
|
||||
$splashColor = Cache::remember(
|
||||
'championSplashColorCache'.$champion->slug,
|
||||
'championSplashColorCache' . $champion->slug,
|
||||
$sixMonthsInSeconds,
|
||||
static fn () => getAverageColorFromImageUrl($champion->getChampionImageAttribute())
|
||||
static fn () => getAverageColorFromImageUrl('https://wsrv.nl/?url=' . $champion->getChampionImageAttribute())
|
||||
);
|
||||
|
||||
$champion->splash_color = $splashColor;
|
||||
|
||||
@@ -55,15 +55,15 @@ class ChampionSkinController extends Controller
|
||||
public function show(ChampionSkin $championSkin)
|
||||
{
|
||||
$skin = Cache::remember(
|
||||
'championSkinShowCache'.$championSkin->slug,
|
||||
'championSkinShowCache' . $championSkin->slug,
|
||||
60 * 60 * 48,
|
||||
static fn () => $championSkin->load('champion', 'chromas')
|
||||
);
|
||||
|
||||
$splashColor = Cache::remember(
|
||||
'championSkinSplashColorCache'.$championSkin->slug,
|
||||
'championSkinSplashColorCache' . $championSkin->slug,
|
||||
60 * 60 * 120,
|
||||
static fn () => getAverageColorFromImageUrl($championSkin->getSkinImageAttribute())
|
||||
getAverageColorFromImageUrl('https://wsrv.nl/?url=' . $championSkin->getSkinImageAttribute())
|
||||
);
|
||||
|
||||
$skin->splash_color = $splashColor;
|
||||
|
||||
Reference in New Issue
Block a user