Use base64 instead of .ico favicon

This commit is contained in:
Jay Trees 2022-04-14 11:44:50 +02:00
parent 37033d70d9
commit 90e87c6a50

View file

@ -37,7 +37,7 @@ class EmbedCache
public function get(bool $generateCache = false): \stdClass public function get(bool $generateCache = false): \stdClass
{ {
$info = null; $info = null;
if (!$this->generateCache() && false === $generateCache) { if (!$this->generateCache() && false === $generateCache) {
$info = json_decode(file_get_contents($this->getFilepath())); $info = json_decode(file_get_contents($this->getFilepath()));
@ -91,6 +91,10 @@ class EmbedCache
$info_simplified->title = (string) $info->title; $info_simplified->title = (string) $info->title;
$info_simplified->url = (string) $info->url; $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 { try {
} catch (\Throwable $ex) { } catch (\Throwable $ex) {
$generateCache = false; $generateCache = false;