From d20bd6d14f1ef7af916fb049efd3fd588773b7cf Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Fri, 20 Nov 2020 20:14:19 +0100 Subject: [PATCH] =?UTF-8?q?RSS=20Images=20int=C3=A9gr=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/blog/blog.php | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/module/blog/blog.php b/module/blog/blog.php index d36c6b1f..33eae3ac 100755 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -133,12 +133,11 @@ class blog extends common { $newsArticle->setAuthor($author,'no@mail.com'); $newsArticle->setId(helper::baseUrl() .$this->getUrl(0) . '/' . $articleId); $newsArticle->setDate(date('r', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']))); - if ($this->_mime_content_type(helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb) !== false) { - $newsArticle->addEnclosure( helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb, - getimagesize(helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb), - $this->_mime_content_type(helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb) - ); - } + $imageData = getimagesize(helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb); + $newsArticle->addEnclosure( helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb, + $imageData[0] * $imageData[1], + $imageData['mime'] + ); $feeds->addItem($newsArticle); } } @@ -753,15 +752,5 @@ class blog extends common { return $this->getData(['user', $userId, 'firstname']); } } - - private function _mime_content_type($filename) { - $result = new finfo(); - - if (is_resource($result) === true) { - return $result->file($filename, FILEINFO_MIME_TYPE); - } - - return false; - } }