mirror of
https://github.com/LinkStackOrg/LinkStack.git
synced 2025-02-08 16:18:45 +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) {
|
function analyzeImageBrightness($file) {
|
||||||
|
try {
|
||||||
$file = base_path('assets/img/background-img/'.$file);
|
$file = base_path('assets/img/background-img/'.$file);
|
||||||
|
|
||||||
// Get image information using getimagesize
|
// Get image information using getimagesize
|
||||||
@ -95,6 +95,9 @@ function analyzeImageBrightness($file) {
|
|||||||
} else {
|
} else {
|
||||||
return 'light';
|
return 'light';
|
||||||
}
|
}
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function infoIcon($tip) {
|
function infoIcon($tip) {
|
||||||
|
@ -12,11 +12,10 @@
|
|||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
@foreach($information as $info) @php $GLOBALS['themeName'] = $info->theme; @endphp @endforeach
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// Theme Config
|
// Theme Config
|
||||||
function theme($key){
|
if (!function_exists('theme')) {
|
||||||
|
function theme($key){
|
||||||
$key = trim($key);
|
$key = trim($key);
|
||||||
$file = base_path('themes/' . $GLOBALS['themeName'] . '/config.php');
|
$file = base_path('themes/' . $GLOBALS['themeName'] . '/config.php');
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
@ -25,13 +24,18 @@ $file = base_path('themes/' . $GLOBALS['themeName'] . '/config.php');
|
|||||||
return $config[$key];
|
return $config[$key];
|
||||||
}}
|
}}
|
||||||
return null;}
|
return null;}
|
||||||
|
}
|
||||||
|
|
||||||
// Theme Custom Asset
|
// Theme Custom Asset
|
||||||
|
if (!function_exists('themeAsset')) {
|
||||||
function themeAsset($path){
|
function themeAsset($path){
|
||||||
$path = url('themes/' . $GLOBALS['themeName'] . '/extra/custom-assets/' . $path);
|
$path = url('themes/' . $GLOBALS['themeName'] . '/extra/custom-assets/' . $path);
|
||||||
return $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
|
@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')
|
@include('layouts.analytics')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user