From 9d7b383c4eefcee8ad130363aa7cd4c8fe1466aa Mon Sep 17 00:00:00 2001 From: Julian Prieber <60265788+JulianPrieber@users.noreply.github.com> Date: Wed, 19 Jul 2023 14:01:13 +0200 Subject: [PATCH] Improved error handling for invalid background images --- app/Functions/functions.php | 5 ++++- resources/views/littlelink.blade.php | 10 +++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/Functions/functions.php b/app/Functions/functions.php index ecc3d18..0a76d83 100644 --- a/app/Functions/functions.php +++ b/app/Functions/functions.php @@ -46,7 +46,7 @@ function findBackground($name) } function analyzeImageBrightness($file) { - + try { $file = base_path('assets/img/background-img/'.$file); // Get image information using getimagesize @@ -95,6 +95,9 @@ function analyzeImageBrightness($file) { } else { return 'light'; } + } catch (\Throwable $th) { + return null; + } } function infoIcon($tip) { diff --git a/resources/views/littlelink.blade.php b/resources/views/littlelink.blade.php index e02e74c..897dd42 100644 --- a/resources/views/littlelink.blade.php +++ b/resources/views/littlelink.blade.php @@ -12,11 +12,10 @@ @endif @endforeach -@foreach($information as $info) @php $GLOBALS['themeName'] = $info->theme; @endphp @endforeach - +@foreach($information as $info) @php $GLOBALS['themeName'] = $info->theme; @endphp @endforeach + @if(theme('enable_custom_code') == "true" and theme('enable_custom_head') == "true" and env('ALLOW_CUSTOM_CODE_IN_THEMES') == 'true')@include($GLOBALS['themeName'] . '.extra.custom-head')@endif @include('layouts.analytics')