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:
Rico van Zelst
2024-03-28 10:34:16 +01:00
parent 5b55e21659
commit 998f386f20
3 changed files with 13 additions and 9 deletions

View File

@@ -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;