aboutsummaryrefslogtreecommitdiff
path: root/lib/favicons.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2024-07-17 17:33:17 +0200
committerGravatar GitHub <noreply@github.com> 2024-07-17 17:33:17 +0200
commit783fe19baa0c4d187a318c4fdec8b89e217a26aa (patch)
tree0a02b187a65113bc4fc120020388eba331733acf /lib/favicons.php
parentb92b80d12484695b762e85f32e6d23303e62a84b (diff)
Remove dependency to exif extension (#6624)
* Remove dependency to exit extension fix https://github.com/FreshRSS/FreshRSS/issues/6573 * Fix return
Diffstat (limited to 'lib/favicons.php')
-rw-r--r--lib/favicons.php13
1 files changed, 13 insertions, 0 deletions
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;
+}