Link to home
Start Free TrialLog in
Avatar of ImpactPhoto
ImpactPhoto

asked on

RSS feed not displaying images

Hi everyone, I've gotten some great help here before, and I've been stumped by a new question. Hope you can help.

I have an RSS feed that is not displaying images (found here: http://impact-photo.org/DirectorPHP/rss.php).  

I put this feed together using Slideshowpro DirectorPHP and the PHP script found here: http://www.sthomas.net/development/slideshowpro-director-rss-generator/

As you can see the feed is live and active, yet does not display images in the rss feed. I use the feed to import pictures  into a feed display on my website: www.impact-photo.org/portfolio/weddings.html (see the bottom, the photos on the left are imported from a working alternate RSS feed from wordpress),

I would love for the feed to look like this http://www.impact-photo.org/photoblog/feed/rss, so it would display images into my web page footer.

How can I tweak the feed so it displays images? Or can you recommend a feed reader that will display the media files in my page?

Thanks for all your help,

-Chris
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

This looks like an ATOM feed, not an RSS feed.  Some good info on RSS is available here:
http://cyber.law.harvard.edu/rss/rss.html
Avatar of ImpactPhoto
ImpactPhoto

ASKER

Ok, is it possible to get images posted in this atom feed?
Sorry, I don't know much about ATOM.  I believe that it is less common than RSS.

Looking at the RSS documentation, there is a native tag for the channel image.  But that may not give you all you want.  Looking at the code snippet from http://www.impact-photo.org/photoblog/feed/rss, it looks like the description uses CDATA to insert an image tag.  This displays well in Firefox.

So my approach would be to use something like the code snippet for the platform and add your image information there.
<?xml version="1.0" encoding="UTF-8"?><rss version="0.92">
<channel>
	<title>Impact Photo &#124; Photoblog</title>
	<link>http://www.impact-photo.org/photoblog</link>
	<description></description>
	<lastBuildDate>Wed, 18 Aug 2010 00:45:29 +0000</lastBuildDate>
	<docs>http://backend.userland.com/rss092</docs>

	<language>en</language>
	

	<item>
		<title>Cloud Study #6</title>
		<description><![CDATA[<img width="188" height="125" src="http://www.impact-photo.org/photoblog/wp-content/uploads/2010/08/Cloud-1-of-1-188x125.jpg" class="attachment-medium wp-post-image" alt="Cloud (1 of 1)" title="Cloud (1 of 1)" />]]></description>
		<link>http://www.impact-photo.org/photoblog/cloud-study/cloud-study-5</link>
			</item>
	<item>

		<title>Cloud Study #5</title>
		<description><![CDATA[<img width="188" height="112" src="http://www.impact-photo.org/photoblog/wp-content/uploads/2010/07/20100602-IMG_7776-Edit-188x112.jpg" class="attachment-medium wp-post-image" alt="20100602-IMG_7776-Edit" title="20100602-IMG_7776-Edit" />]]></description>
		<link>http://www.impact-photo.org/photoblog/cloud-study/cloud-study-5-2</link>
			</item>
	<item>
		<title>Cloud Study #4</title>
		<description><![CDATA[<img width="188" height="53" src="http://www.impact-photo.org/photoblog/wp-content/uploads/2010/07/Cloud-Study-4-188x53.jpg" class="attachment-medium wp-post-image" alt="Cloud Photo Fort Collins Impact Photo" title="Cloud Study #4" />Over 15 Images Stitched together to make this cloudscape. Best viewed large: Click to download full image]]></description>

		<link>http://www.impact-photo.org/photoblog/cloud-study/cloud-study-4-2</link>
			</item>
	<item>
		<title>Cloud Study #3</title>
		<description><![CDATA[<img width="188" height="125" src="http://www.impact-photo.org/photoblog/wp-content/uploads/2010/07/20100622-IMG_9059-Edit2-188x125.jpg" class="attachment-medium wp-post-image" alt="20100622-IMG_9059-Edit" title="20100622-IMG_9059-Edit" />]]></description>
		<link>http://www.impact-photo.org/photoblog/cloud-study/cloud-study-3-3</link>
			</item>

	<item>
		<title>Cloud Study #2</title>
		<description><![CDATA[<img width="188" height="125" src="http://www.impact-photo.org/photoblog/wp-content/uploads/2010/06/Cloud-Study-5-188x125.jpg" class="attachment-medium wp-post-image" alt="Cloud Study 5" title="Cloud Study 5" />]]></description>
		<link>http://www.impact-photo.org/photoblog/cloud-study/cloud-study-2-2</link>
			</item>
</channel>
</rss>

Open in new window

I figured your problem out.
The image doesn't display because it's just a link to the picture and not a image tag. so it will not show in the browser.

I've a simple xml rss parser that i use on my websites that you can use to test. And btw works great.

you need php5 to use this.
<h2>Sample</h2>

<hr size="1" noshade="noshade" />
<?php
// feed link goes here.
$file = file_get_contents("http://impact-photo.org/DirectorPHP/rss.php");
// start the xml element.
$xml = new SimpleXMLElement($file);

// print out the raw feed so you can study it. comment this out when you are done setting up your display.
echo "<pre>";
print_r($xml);
echo "</pre>";
?>

<hr size="1" noshade="noshade" />

<?php
// show some feed variables.
echo "<p>". $xml->channel->title ."<br />". $xml->channel->description ."<br />". $xml->channel->pubDate ."</p>";

// loop through the feed and configure the display however you want.
foreach($xml->channel->item as $feed){
	// show the title with a link to the image
	echo "<p><a href=\"". $feed->link ."\">". $feed->title	."</a><br />" .
	// display the image
	"<img src=\"". $feed->link ."\"><br />". 
	// here's the description and pub date.
	$feed->description." - ". $feed->pubDate." <br /> </p>";


}

?>

Open in new window

Fantastic Inno! Thanks. I feel like things are picking up, and this is all new territory for me, so I appreciate the help.

Currently I have this: http://impact-photo.org/ssp_rss/rssparser.php. What should I do next to make this feed work?

-Chris
Well. optimally. you would use that bit of code in your website to display the images.
you can change the settings for width and height in the image tag.
it's up to you.

what is your ultimate goal?
My ultimate goal is to get the rss feed to publish to a feed reader that is displayed at the bottom of this page: http://www.impact-photo.org/portfolio/wedding.html. When I use the code as provided above, the reader does not interpret the feed and remains blank.

Thanks for your help and patients.
You know. Looking at this some more. I think you need to look at some other rss feeds online.
So you can tweek your rss code.

Look at this code from one of the Yahoo feeds.
The rss has an image tag that the image is in.

Your rss feed only references where the image is located on the web. If you put that <img src="" /> attribute in the description of your rss then the image should display.


<item>

<title>9 killed on hijacked Philippine tourist bus 
    (AP)
</title>
 <link>http://us.rd.yahoo.com/dailynews/rss/topstories/*http://news.yahoo.com/s/ap/20100823/ap_on_re_as/as_philippines_bus_hostages</link>
 
<guid isPermaLink="false">ap/20100823/as_philippines_bus_hostages</guid>

<source>AP</source>

<category>world</category>

<pubDate>Mon, 23 Aug 2010 20:25:27 GMT</pubDate>

<description>&#60;p>&#60;a href="http://us.rd.yahoo.com/dailynews/rss/topstories/*http://news.yahoo.com/s/ap/20100823/ap_on_re_as/as_philippines_bus_hostages">&#60;img src="http://d.yimg.com/a/p/ap/20100823/capt.cdd93fe7b89b447c8fa4a4d30045b3d8-cdd93fe7b89b447c8fa4a4d30045b3d8-0.jpg?x=130&amp;y=97&amp;q=85&amp;sig=_SKAlWwkKM_FfURl_x4aqg--" align="left" height="97" width="130" alt="Policemen prepare to assault the tourist bus seized by dismissed police officer Rolando Mendoza Monday, Aug. 23, 2010 at Manila&#039;s Rizal Park, Philippines. Police stormed the bus after shots were heard from the hostage-taker of 15 Chinese tourists and at least four of the  hostages crawled out of the back door. (AP Photo/Pat Roque)" border="0" />&#60;/a>AP - A 12-hour hostage drama aboard a hijacked Philippine bus ended in bloodshed Monday when an angry ex-policeman demanding his job back gunned down eight Hong Kong tourists before police stormed the vehicle and a sniper killed him.&#60;/p>&#60;br clear="all"/>
</description>

<media:content url="http://d.yimg.com/a/p/ap/20100823/capt.cdd93fe7b89b447c8fa4a4d30045b3d8-cdd93fe7b89b447c8fa4a4d30045b3d8-0.jpg?x=130&amp;y=97&amp;q=85&amp;sig=_SKAlWwkKM_FfURl_x4aqg--" type="image/jpeg" height="97" width="130"/>
<media:text type="html">&#60;p>&#60;a href="http://us.rd.yahoo.com/dailynews/rss/topstories/*http://news.yahoo.com/s/ap/20100823/ap_on_re_as/as_philippines_bus_hostages">&#60;img src="http://d.yimg.com/a/p/ap/20100823/capt.cdd93fe7b89b447c8fa4a4d30045b3d8-cdd93fe7b89b447c8fa4a4d30045b3d8-0.jpg?x=130&amp;y=97&amp;q=85&amp;sig=_SKAlWwkKM_FfURl_x4aqg--" align="left" height="97" width="130" alt="photo" title="Policemen prepare to assault the tourist bus seized by dismissed police officer Rolando Mendoza Monday, Aug. 23, 2010 at Manila&#039;s Rizal Park, Philippines. Police stormed the bus after shots were heard from the hostage-taker of 15 Chinese tourists and at least four of the  hostages crawled out of the back door. (AP Photo/Pat Roque)" border="0"/>&#60;/a>&#60;/p>&#60;br clear="all"/></media:text>

<media:credit role="publishing company">(AP)</media:credit>

</item>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of ImpactPhoto
ImpactPhoto

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial