cpmfetch rss feed for kodak digital picture frame cpmfetch rss feed for kodak digital picture frame
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

cpmfetch rss feed for kodak digital picture frame

Started by gammann, December 28, 2008, 11:51:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gammann

Since I didn't see anything else here about creating a feed for digital picture frames, I thought I'd share how I got mine to work.  The Kodak W1020 frame wanted the <media:content> tag in order to display the picture.  Here is how to add the tag to the rss_lastadded.php feed.

I used the v1.8.0-dev version of feedcreator.class.php.  This version changes the encoding from ISO-8859-1 to utf-8.  It also adds a GUID tag by default.  I'm not sure if these make a difference for the frame, but I tried quite a few things, so once I got it working, I left it alone.

Edit feedcreator.class.php, class RSSCreator091, function createFeed(), change:
$feed.= "<rss version=\"".$this->RSSVersion."\">\n";
to

$feed.= "<rss version=\"".$this->RSSVersion."\"";
if ( isset ($this->media) ){
      $feed.= " xmlns:media=\"http://search.yahoo.com/mrss/\"";
}
$feed.= ">\n";

I got this bit of code from http://www.bitweaver.org/cvs-repo/_bit_rss/feedcreator.class.php?revision=1.10&view=markup

Edit feedcreator.class.php, class RSSCreator091, function createFeed() :
after:
$feed.= $this->_createAdditionalElements($this->items[$i]->additionalElements, "        ");

Add:

if ( $this->items[$i]->media_content!=""){
$feed.= "        <media:content url='".$this->items[$i]->media_content."'/>\n";
}


Edit cfrssget.php, function generateFeedFromResults:
Before this line:
$this->rss->addItem($item);
Add:

$item->media = '';
$item->media_content=''.$this->cpm->cpm_getConfigEntry('cpg_url').$this->cpm->urlEncodeImagePath($this->cpm->getImageToUse($data['pFilepath'],$data['pFilename'], $this->cpm->cfg['_pfx'])) .'';


If anyone knows a better way to do this, please let me know.  I'd like to be able to add the picture desctription at the bottom of the photo, but since the frame seems to ignore every other tag, except the media:content tag, I assume I'd have to generate the picture on the fly, adding the description text to the photo.

Jerry

vuud

Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

gammann

I also wanted the weather mixed in with my photos so I hacked up some code to do so.  Basically this uses weatherforyou.com to supply the images of the weather.  It saves the images to the tmp directory everytime the rss page is called, since the frame would not go out and grab the image from weatherforyou.com on the fly.

In rss_latestadd.php, after:
include "cfrssget_new.php";
Add:

$zip = $_GET['zipcode'];
if ($zip != null)
{
$weather = "http://www.weatherforyou.net/fcgi-bin/hw3/hw3.cgi?config=jpg&forecast=zandh&alt=hwizandh&zipcode=".$zip."&country=us&daysonly=2&maxdays=5";
$tmp_weather_file = ".\\tmp\\".$zip.".jpg";
file_put_contents($tmp_weather_file, file_get_contents($weather));
$weather_img = "cpmfetch/tmp/".$zip.".jpg";
}


In cfrssget.php, class cfrss, add the following function at the end:

function addWeather ($weather_url)
{

$item = new FeedItem();
$titleToUse = "Weather";
$descriptionToUse="";
$item->title = $titleToUse;

$item->link =''.$this->cpm->cpm_getConfigEntry('cpg_url').$weather_url;
$item->media = '';
$item->media_content =''.$this->cpm->cpm_getConfigEntry('cpg_url').$weather_url .'';
$imagetag = '<img src="'.$this->cpm->cpm_getConfigEntry('cpg_url').$weather_url.'" />';
$descriptionToUse = $imagetag . $descriptionToUse.' ';
$item->description = $descriptionToUse;

$item->date = date(DATE_RFC822);

$this->rss->addItem($item);
}


Now when you setup the feed in the frame, add the zipcode variable to the url like:
http://www.mysite.com/cpm/cpmfetch/rss_latestadded.php?zipcode=20500

gammann

forgot to add the following:

in rss_latestadded.php, before the following line:
$cfrss->endFeed();

Add:

if ($zip != null)
{
$cfrss->addWeather($weather_img);
}