fix: skin duplicate bug

This commit is contained in:
Rico van Zelst
2023-11-08 18:47:26 +01:00
parent a61b4f8085
commit c7eae5d41a
6 changed files with 30 additions and 12 deletions

View File

@@ -59,12 +59,9 @@ class ChampionSkin extends Model
return $this->hasMany(SkinChroma::class, 'full_skin_id', 'full_skin_id');
}
public function getSkinImageAttribute(bool $pbe = false): string
public function getSkinImageAttribute(): string
{
if ($pbe) {
return 'https://raw.communitydragon.org/pbe/plugins/rcp-be-lol-game-data/global/default/v1/champion-splashes/' . $this->champion_id . '/' . $this->full_skin_id . '.jpg';
}
return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/splash-art/centered/skin/' . $this->skin_id;
return 'https://raw.communitydragon.org/pbe/plugins/rcp-be-lol-game-data/global/default/v1/champion-splashes/' . $this->champion_id . '/' . $this->full_skin_id . '.jpg';
}
public function getSkinImageLoadingAttribute(): string

20
config/image.php Normal file
View File

@@ -0,0 +1,20 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Image Driver
|--------------------------------------------------------------------------
|
| Intervention Image supports "GD Library" and "Imagick" to process images
| internally. You may choose one of them according to your PHP
| configuration. By default PHP's "GD Library" implementation is used.
|
| Supported: "gd", "imagick"
|
*/
'driver' => 'gd'
];

View File

@@ -44,7 +44,7 @@
@vite('resources/js/app.js')
</head>
<body class="antialiased bg-stone-900 dark">
<body class="antialiased bg-stone-900 dark scroll-smooth">
<x-navbar/>
<x-champions.list_all :champions="$champions" :roles="$roles"/>

View File

@@ -23,7 +23,8 @@
<!-- OpenGraph -->
<meta property="og:site_name" content="Heimerdinger.LoL">
<meta property="og:title" content="{{$champion->name}} • Heimerdinger.LoL">
<meta property="og:description" content="Heimerdinger.LoL: {{$champion->name}} details showing all the information you need to know about {{$champion->name}}, {{$champion->title}}. {{substr($champion->lore, 0, 50)}}...">
<meta property="og:description"
content="Heimerdinger.LoL: {{$champion->name}} details showing all the information you need to know about {{$champion->name}}, {{$champion->title}}. {{substr($champion->lore, 0, 50)}}...">
<meta property="og:locale" content="en">
<meta property="og:type" content="website">
<meta property="og:image" content="{{asset('img/og_image.png')}}">
@@ -32,7 +33,8 @@
<meta name="twitter:card" content="summary_large_image">
<meta property="twitter:domain" content="heimerdinger.lol">
<meta property="twitter:title" content="{{$champion->name}} • Heimerdinger.LoL">
<meta property="twitter:description" content="Heimerdinger.LoL: {{$champion->name}} details showing all the information you need to know about {{$champion->name}}, {{$champion->title}}. {{substr($champion->lore, 0, 50)}}...">
<meta property="twitter:description"
content="Heimerdinger.LoL: {{$champion->name}} details showing all the information you need to know about {{$champion->name}}, {{$champion->title}}. {{substr($champion->lore, 0, 50)}}...">
<meta property="twitter:image" content="{{asset('img/og_image.png')}}">
<link rel="preconnect" href="https://rsms.me/">
@@ -42,12 +44,11 @@
@vite('resources/js/app.js')
</head>
<body class="antialiased bg-stone-900 dark">
<body class="antialiased bg-stone-900 dark scroll-smooth">
<x-navbar/>
<x-champions.grid_info :champion="$champion"/>
</body>
</html>

View File

@@ -21,7 +21,7 @@
<div class="flex flex-col">
<div class="flex flex-col items-center justify-center">
<img loading="lazy" class="border-2 border-orange-400/40 rounded-xl"
src="{{ $skin->getSkinImageAttribute(true) }}"
src="{{ $skin->getSkinImageAttribute() }}"
alt="{{ $skin->skin_name }} Splash Art">
<div class="flex flex-col items-center justify-center">
<h2 class="mt-4 text-xl font-bold text-white">{{ $skin->skin_name }}</h2>

View File

@@ -44,7 +44,7 @@
@vite('resources/js/app.js')
</head>
<body class="antialiased bg-stone-800 dark">
<body class="antialiased bg-stone-800 dark scroll-smooth">
<x-navbar/>
<x-home.features/>
@if ($upcomingSkins != [])