forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 plugins => Topic started by: ff on July 06, 2011, 07:57:05 pm

Title: RSS feed for Kodak EasyShare W1020 Wireless Digital Frame
Post by: ff 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 (http://forum.coppermine-gallery.net/index.php/topic,41197.0.html) 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: