In Drupal 4.4, how do I get an image to post on my outgoing RSS feed?

Comments

candygenius’s picture

I did this by duplicating the format_rss_channel function (in common.inc), renaming it and adding it in the node.module. Change the node_feed function in the node module to call the new function you created instead of format_rss_channel. The new function adds the image tags to the feed:

function format_rss_channel_modified($title, $link, $description, $items, $language = "en", $args = array()) {
// arbitrary elements may be added using the $args associative array

$output = "\n";
$output .= " ". drupal_specialchars(strip_tags($title)) ."\n";
$output .= "
". drupal_specialchars(strip_tags($link)) ."\n";
$output .= " ". drupal_specialchars($description) ."\n";
$output .= " ". drupal_specialchars(strip_tags($language)) ."\n";

$output .= "\n";
$output .= " your title\n";
$output .= " http://www.yoursite.com/image.gif\n";
$output .= "
http://www.yoursite.com/\n";
$output .= " yoursite\n";
$output .= "\n";

foreach ($args as $key => $value) {
$output .= " <$key>". drupal_specialchars(strip_tags($value)) ."\n";
}
$output .= $items;
$output .= "\n";

return $output;
}

I couldn't add the image tags using the existing $args array since there were multiple tags to the image element.