Your Ad Here

Sponsor Advertisement
Flash Templates
Template Monster offers over 8,000 professional webtemplates available for immediate download!
Blogger Talk Blogging Community
Blogs directories, blogging resources, blog tools, blog sites, blogging news, Blog tutorial, Blogging books.

How to add images to RSS Feeds or Atom Feeds


Post new topic   Reply to topic  Invision-Graphics Forum Index –» Image Support –» Print Topic
View previous topic –» View next topic
Site Admin

Admin
Site Admin
Occupation: Web Developer
Location: Canada
blank.gif

Offline
Joined: Nov 26, 2004
Find all post by Admin
Total Posts: 79
0.06 posts per day
Total Words: 26,399
PostPosted: Sat Sep 15, 2007 10:03 pm  Post subject: How to add images to RSS Feeds or Atom Feeds
How to add images to RSS Feeds or Atom Feeds

I was asked how to add images to an RSS Feed or atom feed from a user over at another forum.

So for refrence I thought I would post it here for others to use...

Create a php file called rss-image.php for example and add the following, be sure to edit the fields that I have outlined.

Where it asks for the image url be sure to put the FULL Path to the image file, or sites using your RSS feed will have broken images...

Example: http://www.your-site.com/image.jpg

Also be sure to set the sy:updatePeriod to only one, either hourly, weekly, monthly

Code:
<?php
header("Content-Type: application/xml");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
echo "<rss version=\"2.0\" \n";
echo "  xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n";
echo "  xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\"\n";
echo " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n\n";
echo "<channel>\n";
echo "<title>Site Title Here</title>\n";
echo "<link>http://www.site-url.com</link>\n";
echo "<description>Site description</description>\n";
echo "<managingEditor>you@mail.com</managingEditor>\n";
echo "<webMaster>webmaster@mail.com</webMaster>\n";
echo "<language>us_en</language>\n\n";
echo "<sy:updatePeriod>hourly / weekly / monthly</sy:updatePeriod>\n";
echo "<sy:updateFrequency>2</sy:updateFrequency>\n";
echo "<item>\n";
echo "<image>\n";
echo "<title>Name of Image</title>\n";
echo "<url>http://www.your-site.com/image.gif</url>\n";
echo "<width>Image Width</width>\n";
echo "<height>Image Height</height>\n";
echo "</image>\n";
echo "</item>\n\n";
echo "</channel>\n";
echo "</rss>\n";
?>


This is a basic outline, you can of course make an RSS feed to pull the data from a database and auto fill in the required sections.

Hope some one finds this useful.

Shawn DesRochers Smile


Forum Signature
Affordable Web Hosting | Ultra Game Play
Reply with quote
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Back to top
Sponsor Advertising
Display posts from previous:   
Post new topic   Reply to topic    Invision-Graphics Forum Index -> Image Support All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
 
Credit | Western Union Locations | Loans | Loans | Wills
Click Here to Advertise
Affordable Hosting! http://www.invision-graphics.com/images/banners/468X60_VISIONHOSTING.gif
 Today: 16,310  Yesterday: 44,490  Total Hits: 24,224,770
Page Rendered in: 0.15s - Total Queries: 8 - MySQL DB: 18 mb's - Pages served in past 5 minutes: 196