aboutsummaryrefslogtreecommitdiff
path: root/app/models/Feed.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-10-19 21:22:04 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-10-19 21:22:04 +0200
commit1b83f93670fd190893f5c39845c444b443dbded8 (patch)
tree2edb22a51c263cb93ed3a054a0d02b95190c850a /app/models/Feed.php
parentd94d948706767996102bf53dfc9d651fd58a34e5 (diff)
Ajoute au contenu les images déclarées en tant que 'enclosure'
Corrige https://github.com/marienfressinaud/FreshRSS/issues/205. Uniquement pour les images. Pourrait par exemple faire des miniatures pour les vidéos http://simplepie.org/wiki/tutorial/how_do_i_get_a_thumbnail_from_a_youtube_feed
Diffstat (limited to 'app/models/Feed.php')
-rw-r--r--app/models/Feed.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/Feed.php b/app/models/Feed.php
index 02a4e6be7..19c3d8053 100644
--- a/app/models/Feed.php
+++ b/app/models/Feed.php
@@ -250,6 +250,16 @@ class Feed extends Model {
}
$content = $item->get_content ();
+ $links = array();
+ foreach ($item->get_enclosures() as $enclosure) {
+ $link = $enclosure->get_link();
+ if (array_key_exists($link, $links)) continue;
+ $links[$link] = '1';
+ $mime = strtolower($enclosure->get_type());
+ if (strpos($mime, 'image/') === 0) {
+ $content .= '<br /><img src="' . $link . '" />';
+ }
+ }
$entry = new Entry (
$this->id (),