Fixed error

Call to undefined function exif_imagetype() (View: /htdocs/resources/views/littlelink.blade.php)
This commit is contained in:
Julian Prieber 2023-02-13 20:02:56 +01:00
parent dd722620cb
commit d727455e96
1 changed files with 49 additions and 41 deletions

View File

@ -26,8 +26,15 @@ function analyzeImageBrightness($file) {
$file = base_path('/img/background-img/'.$file); $file = base_path('/img/background-img/'.$file);
// Get image information using getimagesize
$imageInfo = getimagesize($file);
if (!$imageInfo) {
echo "Error: Unable to get image information.\n";
exit();
}
// Get the image type // Get the image type
$type = exif_imagetype($file); $type = $imageInfo[2];
// Load the image based on its type // Load the image based on its type
switch ($type) { switch ($type) {
@ -68,3 +75,4 @@ function analyzeImageBrightness($file) {
return 'light'; return 'light';
} }
} }