mirror of
https://github.com/LinkStackOrg/LinkStack.git
synced 2025-02-02 04:16:44 +01:00
Improved error handling for invalid background images
This commit is contained in:
parent
47f9ce4a01
commit
9d7b383c4e
@ -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) {
|
||||
|
@ -12,11 +12,10 @@
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
@foreach($information as $info) @php $GLOBALS['themeName'] = $info->theme; @endphp @endforeach
|
||||
|
||||
<?php
|
||||
// Theme Config
|
||||
function theme($key){
|
||||
if (!function_exists('theme')) {
|
||||
function theme($key){
|
||||
$key = trim($key);
|
||||
$file = base_path('themes/' . $GLOBALS['themeName'] . '/config.php');
|
||||
if (file_exists($file)) {
|
||||
@ -25,13 +24,18 @@ $file = base_path('themes/' . $GLOBALS['themeName'] . '/config.php');
|
||||
return $config[$key];
|
||||
}}
|
||||
return null;}
|
||||
}
|
||||
|
||||
// Theme Custom Asset
|
||||
if (!function_exists('themeAsset')) {
|
||||
function themeAsset($path){
|
||||
$path = url('themes/' . $GLOBALS['themeName'] . '/extra/custom-assets/' . $path);
|
||||
return $path;}
|
||||
}
|
||||
?>
|
||||
|
||||
@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')
|
||||
|
Loading…
x
Reference in New Issue
Block a user