From 81e6a72a20e115ba8d11e23c0677a0915fedf3ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gregor=20T=C3=A4tzner?= Date: Sat, 21 Jul 2012 23:25:39 +0200 Subject: [PATCH] Improve favicon detection --- lib/utils.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/utils.php b/lib/utils.php index 24dd5493e..a20fc5be8 100644 --- a/lib/utils.php +++ b/lib/utils.php @@ -44,11 +44,16 @@ class OC_News_Utils { $favicon = $spfeed->get_image_url(); //check if this file exists and the size with getimagesize() - + if ($favicon == null) { //handle favicon detection + $favicon = SimplePie_Misc::absolutize_url('/favicon.ico', $url); + + // FIXME check if file exists and is valid + if (false === file_get_contents($favicon, 0, null, 0, 1)) + $favicon = null; } - + $feed->setFavicon($favicon); return $feed;