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: RSS feed for Kodak EasyShare W1020 Wireless Digital Frame  (Read 6182 times)

0 Members and 1 Guest are viewing this topic.

ff

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 108
RSS feed for Kodak EasyShare W1020 Wireless Digital Frame
« on: July 06, 2011, 07:57:05 pm »

The Kodak EasyShare W1020 Wireless Digital Frame had the ability to show images with help from Framechannel.com. They, however, terminated their services.

This frame also has the ability to show a RSS-feed with images.
Problem is that normally RSS-feeds show the most recent images.

I edited Slider in Coppermine to create a simple RSS-feed which updates every 15 minutes.

I have a file (rss.php) with the code beneath in the root of my album.
Code: [Select]
<?php
/****************************************************************************
This script choose random pics (15 by default) from your coppermine album.
It then creates a rss-feed for the Kodak digital image frame which is refreshed every 15 minutes.
*****************************************************************************/
// Initialisation
define('IN_COPPERMINE'true);

//For all tests only,uncomment the line "required..." and run the script by http://your-site/slider.php
require('include/init.inc.php');
// maximum pics to show
$limit=100;
//clear FORBIDDEN_SET for logged in users with nothing forbidden (not needed in 1.5)
//if ($FORBIDDEN_SET != "") $FORBIDDEN_SET = "AND $FORBIDDEN_SET";
// request of your database
$query "SELECT * FROM {$CONFIG['TABLE_PICTURES']} as p WHERE approved = 'YES' AND filename LIKE '%.jpg' $FORBIDDEN_SET ORDER BY RAND() LIMIT $limit";
// result of request
$result cpg_db_query($query);
// For reading result
$rowset = array();
// Index of tab
$i=0;
// For each pic.....building javascript in php
echo "<rss version=\"2.0\" xmlns:media=\"http://search.yahoo.com/mrss/\">
<channel>
    <title>
$CONFIG[gallery_name]$CONFIG[gallery_description] - $album_name</title>
    <link>
$CONFIG[ecards_more_pic_target]</link>
    <description>
$CONFIG[gallery_description] - $album_name</description>
    <generator>
$CONFIG[ecards_more_pic_target]rss.php</generator>
<ttl>15</ttl>
"
;
while(
$row mysql_fetch_array($result)){
      
//reading filename of pic and other info
      
$filename=$row['filename'];
$image_url $CONFIG['ecards_more_pic_target'];
      
$prefix "normal_";
      
$file="albums".$row['filepath']."normal_".$row['filename'];
               if (
file_exists($file)) {
                          
$prefix "normal_";
               } else {
                          
$prefix "";
               }
        
// path of pic
        
$file="albums/".$row['filepath'].$prefix.$row['filename'];
      
// final check that the file exists, if so, show picture
      
if (file_exists($file)) {
                 
$lien=$file;
      }
        
// building javascript code
        
echo "<item><media:content url=\"".$image_url.$lien."\" type=\"image/jpeg\"> </media:content></item>\n";
        
$i=$i+1;
}
echo 
"</channel>
</rss>"
;

To do:
  • Replace hardcoded "albums/" by "$image_url". When I try this, the URL is gone.
  • Have an extra check in 'last updated' for the 10 last images which are shown more often in this feed.
Logged
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 19 queries.