From 90e87c6a50c93b2f140da98f7c498f829c7226a4 Mon Sep 17 00:00:00 2001 From: Jay Trees Date: Thu, 14 Apr 2022 11:44:50 +0200 Subject: [PATCH] Use base64 instead of .ico favicon --- src/classes/embed-cache.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/classes/embed-cache.php b/src/classes/embed-cache.php index 60af9820..55171295 100644 --- a/src/classes/embed-cache.php +++ b/src/classes/embed-cache.php @@ -37,7 +37,7 @@ class EmbedCache public function get(bool $generateCache = false): \stdClass { - $info = null; + $info = null; if (!$this->generateCache() && false === $generateCache) { $info = json_decode(file_get_contents($this->getFilepath())); @@ -91,6 +91,10 @@ class EmbedCache $info_simplified->title = (string) $info->title; $info_simplified->url = (string) $info->url; + if (str_contains(pathinfo($info->favicon, PATHINFO_EXTENSION), 'ico')) { + $info_simplified->favicon = 'data:image/x-icon;base64,' . base64_encode(file_get_contents($info_simplified->favicon)); + } + try { } catch (\Throwable $ex) { $generateCache = false;