mibe / FeedWriter

PHP Universal Feed Generator

Home Page:http://ajaxray.com/blog/php-universal-feed-generator-supports-rss-10-rss-20-and-atom

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Set image to item

devloe opened this issue · comments

Is it possible to set an image to an item?

Something like setImage() is missing!

Well, neither the RSS1, the RSS2 nor the ATOM feed specification do provide a direct feature to add an image to a feed item.

But you could use an media enclosure to the item:
$item->setEnclosure('http://example.com/image.jpg', 123456, 'image/jpeg');

Since the feeds are easily extendable, another possible solution would be to use the Media RSS Specification module:

$feed->addNamespace('media', 'http://search.yahoo.com/mrss/');
$item->addElement('media:thumbnail', '', array('url' => 'http://example.com/image.jpg', 'height' => '75', 'width' => '75'));