fix: [internal] Normalize extension for image helper

Fixes #9692
pull/9693/head
Jakub Onderka 2024-04-19 23:39:35 +02:00
parent 9f3e6ce20e
commit b64e0bc61d
1 changed files with 3 additions and 2 deletions

View File

@ -8,6 +8,7 @@ class ImageHelper extends AppHelper
private $imageCache = [];
/**
* Converts image file to data format
* @param string $imagePath Path to file
* @return string
* @throws Exception
@ -18,13 +19,13 @@ class ImageHelper extends AppHelper
return $this->imageCache[$imagePath];
}
$ext = pathinfo($imagePath, PATHINFO_EXTENSION);
$ext = strtolower(pathinfo($imagePath, PATHINFO_EXTENSION));
if ($ext === 'svg') {
$mime = 'image/svg+xml';
} else if ($ext === 'png') {
$mime = 'image/png';
} else {
throw new InvalidArgumentException("Only SVG and PNG images are supported");
throw new InvalidArgumentException("Only SVG and PNG images are supported, '$ext' file provided.");
}
try {