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 2 [3]   Go Down

Author Topic: Get RSS Feeds from Coppermine now!( shows album's title and descriptions)  (Read 63162 times)

0 Members and 1 Guest are viewing this topic.

Pope-UK

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Get RSS Feeds from Coppermine now!( shows album's title and descriptions)
« Reply #40 on: November 17, 2008, 07:41:56 pm »

Updated again so that the rss feed supplies the images in a format that the google photos screensaver recognises...

Code: [Select]
<?php
//
//  Coppermine RSS 2.0 Generator (1.0)
// displays latest photo via RSS 2.0 feed.
//  Compatible with : Coppermine 1.3.x
//
// Hacked at : 22 October 2005, 0400 +0800
//
// Copyright (C) 2005 Mohammad Hafiz bin Ismail (mypapit)
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//
// Report problems and direct all questions to:
//
// <mypapit@gmail.com>
//
// For latest version of this software, please visit :
//
// http://mypapit.net/pproject
// http://blog.mypapit.net/
//
// authors email : mypapit@gmail.com, papit01@lycos.com
//
//
// Modified by Wieland E. Kublun www.kublun.com on 29/September/2006
//
// Now this mod displays the album's title and description

$upperlimit 6//default = 6


define('INC_COMMENT_TIMES'false);
define('FILEDUMP'false);
define('GZ_COMPRESS'false);
// [0.0 <= priority <= 1.0]
define('P_DISPLAYIMAGE'0.5);
define('P_ALBUM'0.5);
define('P_CATEGORY'0.5);

// [changefreq = always || hourly || daily || weekly || monthly || yearly || never]
define('CF_DISPLAYIMAGE''unspecified');
define('CF_ALBUM''unspecified');
define('CF_CATEGORY''unspecified');

define('IN_COPPERMINE'true);
require(
'include/init.inc.php');

// This should work as it is, but hardcode if necessary.
define('CPG14'version_compare(COPPERMINE_VERSION"1.4.0"">="));
define('PHP5'version_compare(phpversion(), "5"">="));
$base rtrim($CONFIG['ecards_more_pic_target'], '/');
$albumpath "$base/" $CONFIG['fullpath'];

function 
lmdate($timestamp)
{
if (PHP5){
return date('c'$timestamp);
} else {
return date('D, d M Y H:i:s +0800'$timestamp date('Z'));
}
}

// No user servicable parts below here
ob_flush();
header("Content-type: text/xml; charset=utf-8");
print 
"<?xml version=\"1.0\" encoding=\"utf-8\"?>
\n";
print "<rss version=\"2.0\"
        xmlns:media=\"http://search.yahoo.com/mrss/\"
    xmlns:dc=\"http://purl.org/dc/elements/1.1/\" >";

$result = mysql_query("SELECT aid, title, description FROM {$CONFIG['TABLE_ALBUMS']} ORDER BY title ASC");
while (list($aaid, $atitle, $adescription) = mysql_fetch_row($result)) {
print "<channel>\n";
print "<title>$atitle</title>\n";
print "<link>$base</link>\n";
print "<description>$adescription</description>";
print "<language>en-GB</language>\n";
print "<lastBuildDate>"  . lmdate(time()) . "</lastBuildDate>\n";
print "<generator>Coppermine RSS 2.0 Generator (1.0)</generator>\n";

$result2 = mysql_query("SELECT pid, aid, caption, ctime, title, keywords, filepath, filename, owner_name, pwidth, pheight FROM {$CONFIG
['TABLE_PICTURES']} WHERE aid=$aaid ORDER BY ctime DESC, pid DESC LIMIT
0,$upperlimit");

while (list($pid, $aid,$desc, $ctime, $title, $keywords,$filepath,$filename, $owner, $width, $height) = mysql_fetch_row($result2)) {
print "\t<item>\n";
print "\t\t<title> $title </title>\n";
print "\t\t<link>$base/displayimage.php?pos=-$pid</link>\n";
print "\t\t<author>$owner</author>\n";
print "\t\t<pubDate>" . lmdate($ctime) . "</pubDate>\n";
print "\t\t<description>";
echo  htmlentities("<p><a href=\"$base/displayimage.php?pos=-$pid\"><img src=\"$albumpath$filepath"."thumb_$filename\" alt=\"\" border=\"0px\" /></a></p>");
echo htmlentities("<a href=\"$base/displayimage.php?pos=-$pid\">$title</a><br/><br/><br/>$desc");
print "</description>\n";
print "\t\t<keywords>";
echo htmlentities("$keywords");
print "\t\t</keywords>\n";
print "\t\t<media:content url=\"$albumpath$filepath$filename\" height=\"$pheight\" width=\"$pwidth\"/>";
print "\t\t<media:title>$title</media:title>";
print "\t\t<media:description type=\"html\">";
echo htmlentities("$desc");
print "</media:description>";
print "\t\t<media:thumbnail url=\"$albumpath$filepath"."thumb_$filename\" />";
print "\t\t<media:credit role=\"photographer\">$owner</media:credit>";
print "\t\t<media:category>";
echo htmlentities("$keywords");
print "</media:category>";
print "\t</item>\n";
print "\n";
}
print "</channel>";
}
print "</rss>";
Logged

PeterLawrence

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 22
    • Civil Service Canoe Club
Re: Get RSS Feeds from Coppermine now!( shows album's title and descriptions)
« Reply #41 on: December 22, 2008, 02:20:25 pm »

To make the above code display a feed for one particular album the following changes can be made.

Replace the following code
Code: [Select]
$result = mysql_query("SELECT aid, title, description FROM {$CONFIG['TABLE_ALBUMS']} ORDER BY title ASC");
with
Code: [Select]
if (isset($_GET['album'])) // just want an RSS feed for one particular album
{
$TheAlbum = (int) $_GET['album']; // first clean the input
$result = mysql_query("SELECT aid, title, description FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid=$TheAlbum");
}
else
{
$result = mysql_query("SELECT aid, title, description FROM {$CONFIG['TABLE_ALBUMS']} ORDER BY title ASC");
}

Now for example entering  rss.php?album=10 will display an RSS feed for just album 10.
Logged

sphinxie

  • Coppermine newbie
  • Offline Offline
  • Posts: 2

Hi,

First of all, am new here so sorry for my questions ^^

I have a coppermine gallery on a site, and we have facebook.
Now i want to combine those two. So is this the solution?
What should i do to make this script work? And where should i upload this file?

grtz
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de

Respect board rules for a start. Read the documentation that comes with cpmFetch. I have no idea how Facebook is related though.
Logged

sphinxie

  • Coppermine newbie
  • Offline Offline
  • Posts: 2

What do you mean whit respect board rules?
Sorry what did i do wrong?

greatings
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de

Greetings to you as well. Board rules can be found by clicking on the corresponding link in the forum's navigation, or by performing a search.
One of them says that it's mandatory to post a link to your gallery; one of them says that you need to have read the docs before being allowed to post questions. Another one says that you mustn't clutter sticky announcement threads with your inidividual issues. As you can see, you broke several of them. After being told about board rules I find it outrageous to play silly and ask "what board rules", as this shows that you haven't cared to read them.
You agreed to respect board rules when you signed up, and each time you compose a posting a summary of those rules has been displayed for you as well under the heading "Posting rules", inside a big box that tried to grab your attention by using a yellow background and a dashed red border. ::)
Locking.
Logged
Pages: 1 2 [3]   Go Up
 

Page created in 0.026 seconds with 19 queries.