From 783fe19baa0c4d187a318c4fdec8b89e217a26aa Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 17 Jul 2024 17:33:17 +0200 Subject: Remove dependency to exif extension (#6624) * Remove dependency to exit extension fix https://github.com/FreshRSS/FreshRSS/issues/6573 * Fix return --- lib/favicons.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/favicons.php') diff --git a/lib/favicons.php b/lib/favicons.php index a9ebf9f30..3795dc43e 100644 --- a/lib/favicons.php +++ b/lib/favicons.php @@ -132,3 +132,16 @@ function download_favicon(string $url, string $dest): bool { return ($favicon != '' && file_put_contents($dest, $favicon) > 0) || @copy(DEFAULT_FAVICON, $dest); } + +function contentType(string $ico): string { + $ico_content_type = 'image/x-icon'; + if (function_exists('mime_content_type')) { + $ico_content_type = mime_content_type($ico) ?: $ico_content_type; + } + switch ($ico_content_type) { + case 'image/svg': + $ico_content_type = 'image/svg+xml'; + break; + } + return $ico_content_type; +} -- cgit v1.2.3