Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: cpmfetch rss feed for kodak digital picture frame  (Read 8846 times)

0 Members and 1 Guest are viewing this topic.

gammann

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
cpmfetch rss feed for kodak digital picture frame
« on: December 28, 2008, 11:51:54 pm »

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:
Code: [Select]
$feed.= "<rss version=\"".$this->RSSVersion."\">\n";to
Code: [Select]
$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:
Code: [Select]
$feed.= $this->_createAdditionalElements($this->items[$i]->additionalElements, "        ");
Add:
Code: [Select]
if ( $this->items[$i]->media_content!=""){
$feed.= "        <media:content url='".$this->items[$i]->media_content."'/>\n";
}

Edit cfrssget.php, function generateFeedFromResults:
Before this line:
Code: [Select]
$this->rss->addItem($item); Add:
Code: [Select]
$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
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: cpmfetch rss feed for kodak digital picture frame
« Reply #1 on: December 29, 2008, 03:49:59 am »

This is fantastic!
Logged
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

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: cpmfetch rss feed for kodak digital picture frame
« Reply #2 on: January 11, 2009, 06:56:18 am »

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:
Code: [Select]
include "cfrssget_new.php";Add:
Code: [Select]
$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:
Code: [Select]
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
Logged

gammann

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: cpmfetch rss feed for kodak digital picture frame
« Reply #3 on: January 11, 2009, 07:07:24 am »

forgot to add the following:

in rss_latestadded.php, before the following line:
Code: [Select]
$cfrss->endFeed();
Add:
Code: [Select]
if ($zip != null)
{
$cfrss->addWeather($weather_img);
}
Logged
Pages: [1]   Go Up
 

Page created in 0.028 seconds with 20 queries.