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 63155 times)

0 Members and 1 Guest are viewing this topic.

ir803

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 92
Re: Get RSS Feeds from Coppermine now!( shows album's title and descriptions)
« Reply #20 on: February 12, 2007, 12:19:37 am »

I'm not getting a title on my feed and it doesn't validate, also neither my IE7 or firefox or safari are saying there is a feed available (no live feed icon)  even though when you actually go to the feed it works and you can subscribe to it from there. http://www.ghsimages.co.uk/
Logged

Nibbler

  • Guest
Re: Get RSS Feeds from Coppermine now!( shows album's title and descriptions)
« Reply #21 on: February 12, 2007, 12:31:02 am »

Does your gallery have a name? I expect you need to add code into your <head> for the browser to know there is a feed available.
Logged

ir803

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 92
Re: Get RSS Feeds from Coppermine now!( shows album's title and descriptions)
« Reply #22 on: February 12, 2007, 11:45:56 am »

OK I've put the name in the title tag but still no joy.
Code: [Select]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="mssmarttagspreventparsing" content="true" />
<title>GHS Images</title>
<meta name="keywords" content=""/>
<meta name="description" content=""/>
{META}
<link rel="stylesheet" href="themes/chaoticsoul/style.css" type="text/css" />
<script type="text/javascript" src="scripts.js"></script>
<link rel="shortcut icon" href="favicon.ico" />
</head>
Logged

kraftworkz

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Get RSS Feeds - W/Paypal Mod - Perhaps a Conflict?
« Reply #23 on: February 16, 2007, 05:18:25 am »

Hi All,

CPG 1.4.9
Paypal shopping cart mod (custom displayimage.php file)
Just tried dropping this little RSS mod into the gallery root, unchanged save for the file name to .php

Tried to validate but it failed.

The feed url is here.

Wondering if the Paypal mod is to blame? Any ideas? Thanks!

Can you tell us how you got it to work the way you have it? Can you post the code please?

Logged

a-p

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Get RSS Feeds from Coppermine now!( shows album's title and descriptions)
« Reply #24 on: February 18, 2007, 10:27:03 am »

i've put RSS.php on my server, it works, it takes the image & the category names, but it doesn't take the link well :(

it gives me the link: http://www.avatar-paradise.com/displayimage--1650.html and it should be http://www.avatar-paradise.com/displayimage-27-0.html


the difference is that in RSS it gives me: displayimage--PID.html and it should be displayimage-AID-position_in_the_album.html

i tried to modify the RSS.php, but it gives me: displayimage--27.html - i don't know how to get rid of one "-" and to put after the $aid the position in the album of the image :(

Code: [Select]
print "\t<item>\n";
print "\t\t<title> $title </title>\n";
print "\t\t<link>$base/displayimage.php?pos=-$aid</link>\n";
Logged

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263

I'm using this and I keep getting the album name, not the title of the file uploaded, is there away of changing this

the feed is http://cdcoverhideout.com/gallery/rss.php ;D
Logged

pepemosca

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 25

Here is my mod to this:

Code: [Select]
<?php

//  Dieg0.com.ar RSS 2.0 Generator
// displays latest photo via RSS 2.0 feed.
//
// Modified by Diego Bretti www.Dieg0.com.ar on 28/Feb/2007
//
//      Copyright (c) 2007 Diego Bretti
//
// This mod displays the album's title and description

define('IN_COPPERMINE'true);
require(
'include/init.inc.php');
$base rtrim($CONFIG['ecards_more_pic_target'], '/');

header("Content-type: text/xml; charset=utf-8");
print 
"<?xml version=\"1.0\" encoding=\"utf-8\"?>
\n";
print "<rss version=\"2.0\">\n";
print "<channel>\n";
print "<title>{$CONFIG['gallery_name']} - RSS Albums</title>\n";
print "<link>$base</link>\n";
print "<description>{$CONFIG['gallery_description']}</description>\n";
print "<language>es-AR</language>\n";
print "<category>{$CONFIG['gallery_name']}</category>\n";
print "<lastBuildDate>" . date('D, d M Y H:i:s +0800') . "</lastBuildDate>\n";
print "<copyright>Copyright (c) 2007 Diego Bretti</copyright>\n";
print "<generator>Dieg0.com.ar RSS 2.0 Generator</generator>\n";
print "<docs>$base/rss.php</docs>\n";
print "<ttl>10</ttl>\n";
print "<image>\n";
print "<title>{$CONFIG['gallery_name']}</title>\n";
print "<url>http://www.dieg0.com.ar/image/valid-rss.png</url>\n";
print "<link>$base</link>\n";
print "</image>\n";

//LIMIT 0,*
$result = mysql_query("SELECT aid,title FROM cpg_albums ORDER BY aid DESC LIMIT 0,10");

while(list($album,$title) = mysql_fetch_row($result))
{
$result2 = mysql_query("SELECT pid,filepath,filename,ctime FROM cpg_pictures WHERE aid=$album ORDER BY pid ASC LIMIT 5");
print "\t<item>\n";
print "\t\t<title>$title</title>\n";
print "\t\t<author>{$CONFIG['gallery_name']}</author>\n";
print "\t\t<link>$base/thumbnails.php?album=$album</link>\n";
print "\t\t<guid isPermaLink=\"true\">$base/thumbnails.php?album=$album</guid>\n";
print "\t\t<description>\n";

$result3 = mysql_query("SELECT COUNT(*) FROM cpg_pictures WHERE aid=$album");

$aid = mysql_fetch_row($result3);

if($aid[0]==1)
{print "\t\t<![CDATA[Foto del &#225;lbum &#34;<a href=\"$base/thumbnails.php?album=$album\">$title</a>&#34;.<br/><br/>]]>\n";}
elseif($aid[0]>1 && $aid[0]<=5)
{print "\t\t<![CDATA[Fotos del &#225;lbum &#34;<a href=\"$base/thumbnails.php?album=$album\">$title</a>&#34; con " . $aid[0] . " im&#225;genes.<br/><br/>]]>\n";}
else
{print "\t\t<![CDATA[Primeras fotos del &#225;lbum &#34;<a href=\"$base/thumbnails.php?album=$album\">$title</a>&#34; con " . $aid[0] . " im&#225;genes.<br/><br/>]]>\n";}


$time='';
while(list($pid,$filepath,$filename,$ctime) = mysql_fetch_row($result2))
{
print "\t\t<![CDATA[<a href=\"$base/displayimage.php?pos=-$pid\"><img src=\"$base/albums/$filepath" . "thumb_$filename\" alt=\"\" border=\"0px\" /></a>&nbsp;&nbsp;]]>\n";
$time=$ctime;
}

// $result4 = mysql_query("SELECT SUM(hits) FROM cpg_pictures WHERE aid=$album");
// $hits = mysql_fetch_row($result4);
// print "\t\t<![CDATA[<br/><br/>" . $hits[0] . " im&#225;genes vistas desde el " . date('d M Y', $time - date('Z')) . ".]]>\n";
// print "\t\t<![CDATA[<br/><br/>&#193;lbum creado el " . date('d M Y', $time - date('Z')) . ".]]>\n";

print "\t\t</description>\n";
print "\t\t<pubDate>" . date('D, d M Y H:i:s +0800', $time - date('Z')) . "</pubDate>\n";
print "\t</item>\n";
}

print "</channel>\n";
print "<!--Powered by Diego Bretti-->\n";
print "</rss>";
?>

Comments?
Thanks!
Logged

mentalist3d

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 51
  • http://concepts.org.uk
    • Concept Art
Re: Get RSS Feeds from Coppermine now!( shows album's title and descriptions)
« Reply #27 on: October 29, 2007, 05:25:32 pm »

The original worked a charm for me, had a quick look at the second, only prob I had with that is that it didn't recognise any albums, but I'll look into it further, Thanks all another good contribution to the coppermine product :-)
Logged

pepemosca

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 25
Re: Get RSS Feeds from Coppermine now!( shows album's title and descriptions)
« Reply #28 on: November 10, 2007, 02:27:06 am »

This one is for RSS the Comments:

Code: [Select]
<?php

//  Dieg0.com.ar RSS 2.0 Generator
// displays latest photo via RSS 2.0 feed.
//
// Modified by Dieg0.com.ar on 02/Jun/2007
//
//      Copyright (c) 2007 Dieg0 & pepemosca (30/Jun/2007)
//
// This mod displays the photos's comments

define('IN_COPPERMINE'true);
require(
'include/init.inc.php');
require(
'include/smilies.inc.php');
$base rtrim($CONFIG['ecards_more_pic_target'], '/');

header("Content-type: text/xml; charset=utf-8");
print 
"<?xml version=\"1.0\" encoding=\"utf-8\"?>
\n";
print "<rss version=\"2.0\">\n";
print "<channel>\n";
print "<title>{$CONFIG['gallery_name']} - RSS Comments</title>\n";
print "<link>$base</link>\n";
print "<description>{$CONFIG['gallery_description']}</description>\n";
print "<language>es-AR</language>\n";
print "<category>{$CONFIG['gallery_name']}</category>\n";
print "<lastBuildDate>" . date('D, d M Y H:i:s +0800') . "</lastBuildDate>\n";
print "<copyright>Copyright (c) 2007 Dieg0.com.ar </copyright>\n";
print "<generator>Dieg0.com.ar RSS 2.0 Generator</generator>\n";
print "<docs>$base/rss-comments.php</docs>\n";
print "<ttl>10</ttl>\n";
print "<image>\n";
print "<title>{$CONFIG['gallery_name']}</title>\n";
print "<link>$base</link>\n";
print "</image>\n";

$result = mysql_query("SELECT pid,msg_id,msg_author,msg_body,msg_date,msg_raw_ip FROM cpg_comments ORDER BY msg_id DESC LIMIT 0,10");

while(list($r_pid,$r_msg_id,$r_msg_author,$r_msg_body,$r_msg_date,$r_msg_raw_ip) = mysql_fetch_row($result))
{
$result2 = mysql_query("SELECT aid,filename,filepath FROM cpg_pictures WHERE pid=$r_pid");
list($r_aid,$r_filename,$r_filepath) = mysql_fetch_row($result2);

$result3 = mysql_query("SELECT title FROM cpg_albums WHERE aid=$r_aid");
list($r_title) = mysql_fetch_row($result3);

print "\t<item>\n";
print "\t\t<title>Comentario en el &#225;lbum &quot;" . $r_title . "&quot; por " . $r_msg_author . "</title>\n";
print "\t\t<author>" . $r_msg_author . "</author>\n";
print "\t\t<link>$base/displayimage.php?pos=-$r_pid</link>\n";
print "\t\t<guid isPermaLink=\"true\">$base/displayimage.php?pos=-$r_pid</guid>\n";

print "\t\t<description>\n";

print "\t\t<![CDATA[<a href=\"$base/displayimage.php?pos=-" . $r_pid . "\"><img src=\"$base/albums/" . $r_filepath . "thumb_" . $r_filename . "\" alt=\"\" border=\"0px\" /></a><br/><br/>]]>\n";

print "\t\t<![CDATA[<b>&#193;lbum:</b> " . $r_title . "<br/><b>Autor:</b> " . $r_msg_author . "<br/><b>Comentario:</b> " . bb_decode(process_smilies($r_msg_body, $CONFIG['ecards_more_pic_target'])) . "<br/><b>IP:</b> " . $r_msg_raw_ip . "<br/>]]>\n";

// Para la tabla de historial
$result4 = mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM cpg_comments WHERE pid=$r_pid AND msg_id<=$r_msg_id"));
if($result4[0]>1)
{
print "\t\t<![CDATA[<br/><b>Historial de comentarios:</b><br/>]]>\n";
print "\t\t<![CDATA[<table border=0 cellpadding=2><tr><td><b>Autor</b></td><td><b>Comentario</b></td><td><b>Fecha</b></td><td><b>IP</b></td></tr>]]>\n";

$result5 = mysql_query("SELECT msg_author,msg_body,msg_date,msg_raw_ip FROM cpg_comments WHERE pid=$r_pid AND msg_id<=$r_msg_id ORDER BY msg_id ASC");
while(list($r_msg_author_c,$r_msg_body_c,$r_msg_date_c,$r_msg_raw_ip_c) = mysql_fetch_row($result5))
{
print "\t\t<![CDATA[<tr><td>$r_msg_author_c</td><td>" . bb_decode(process_smilies($r_msg_body_c, $CONFIG['ecards_more_pic_target'])) . "</td><td>$r_msg_date_c</td><td>$r_msg_raw_ip_c</td></tr>]]>\n";
}
print "\t\t<![CDATA[</table>]]>\n";
}
// Fin de la tabla de historial

print "\t\t</description>\n";
print "\t\t<pubDate>" . $r_msg_date . "</pubDate>\n";
print "\t</item>\n";
}

print "</channel>\n";
print "<!--Powered by Dieg0.com.ar-->\n";
print "</rss>";
?>

Comments?
Logged

Aeronautic

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 125
  • Photographer / film maker turned webmeister...
Re: Get RSS Feeds - W/Paypal Mod - Perhaps a Conflict?
« Reply #29 on: January 28, 2008, 08:14:30 pm »

Can you tell us how you got it to work the way you have it? Can you post the code please?

Sure, my cfrssget.php uses the following settings:

Code: [Select]
if ($ENABLED) {

$partialurltocpm = "/yourcopperminefolder"; //Part of the URL to CPG without the host and domain
$default_command = "last"; //What to do if no cmd is specified
// THESE SPECIFY THE INFORMATION USED IN YOUR FEED
  // You only need to use this if you will be using this file as a feed

$rssFeedTitle = "SOMETITLETEXT";
$rssFeedDescription = "SOMEDESCRIPTIONTEXT.";
$rssFeedSiteUrl = "http://www.YOURFULLDOMAIN.com/yourcopperminefolder/";
$rssFeedProviderUrl = "http://www.YOURFULLDOMAIN.com/cpmfetch/rss_lastadded.php";
$rssFeedImageTitle = "SOMETITLETEXT";
$rssFeedImageURL = 'http://www.YOURFULLDOMAIN.com/path/tofeedimage.sometype';
$rssFeedImageLink = "http://www.YOURFULLDOMAIN.com/yourcopperminefolder/";
$rssFeedImageAlt = "SOMEALTTEXT";

$rssItemTitle = "%a SOMETEXT";
$rssItemAlternateTitle = "%a SOMETEXT";

$rssItemDescription = "%f from album %a<br/>%c";
$rssItemAlternateDescription = "%f from %a<br/>%a: %d";
$totalToShow = 22;

///// END OF USER SETTINGS /////////

Replace those generics with your specifics (domain, folders, text, etc.)

Feed in action displayed on another website: stock footage
Logged

alanpalan

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 60
Re: Get RSS Feeds from Coppermine now!( shows album's title and descriptions)
« Reply #30 on: February 19, 2008, 06:57:00 pm »

I have the same question as Will: I tried this mod (by wieland), but it displays only updated album names, not the titles of the new files.
Is there a way how to display titles of the new files in RSS feed? Thanks for the answer!
Logged

jaiak

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 34
  • Spanish
    • Spanish Young People Electronic Music and Concerts
Re: Get RSS Feeds from Coppermine now!( shows album's title and descriptions)
« Reply #31 on: February 20, 2008, 05:00:38 am »

I have adapted this code for show the last álbums in the coppermine gallery (with SEO MOD installed)

This is the code:

Code: [Select]
<?php define('IN_COPPERMINE'true); require('include/init.inc.php'); $base rtrim($CONFIG['ecards_more_pic_target'], '/'); $albumpath "$base/" $CONFIG['fullpath']; $result mysql_query("SELECT tb.aid, ta.title FROM {$CONFIG['TABLE_ALBUMS']} tb LEFT OUTER JOIN {$CONFIG['TABLE_ALBUMS']} ta ON tb.aid = ta.aid ORDER BY ta.aid DESC LIMIT 0,3"); while (list($aid$title) = mysql_fetch_row($result)) { echo "<a href=$base/thumbnails-$aid.html>$title</a><br>"; } ?>
What is your opinion?

Regards from spain
Logged

soleiltan2

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 64
    • SandRailsOnly
Re: Get RSS Feeds from Coppermine now!( shows album's title and descriptions)
« Reply #32 on: February 22, 2008, 09:58:56 pm »

www.sandrailsonly.com/coppermine/rss.php

Used the following code for my rss.php. Placed it in my gallery root and tried to Validate.

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

header("Content-type: text/xml; charset=utf-8");
print 
"<?xml version=\"1.0\" encoding=\"utf-8\"?>
\n";
print "<rss version=\"2.0\">";
print "<channel>\n";
print "<title>{$CONFIG['gallery_name']}</title>\n";
print "<link>$base</link>\n";
print "<description>{$CONFIG['gallery_description']}</description>";
print "<language>es-MX</language>\n";
print "<lastBuildDate>"  . lmdate(time()) . "</lastBuildDate>\n";
print "<generator>Coppermine RSS 2.0 Generator (1.0)</generator>\n";
   
   

$result = mysql_query("SELECT  tb.pid,tb.aid,ta.aid,ta.description,tb.ctime,ta.title,tb.keywords,tb.filepath,tb.filename FROM {$CONFIG['TABLE_PICTURES']} tb LEFT OUTER JOIN {$CONFIG['TABLE_ALBUMS']} ta ON tb.aid = ta.aid ORDER BY tb.pid DESC LIMIT 0,$upperlimit");
while (list($pid, $aid,$aaid,$desc, $ctime, $title, $keywords,$filepath,$filename) = mysql_fetch_row($result)) {
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>{$CONFIG['gallery_admin_email']}</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 "<a href=\"$base/displayimage.php?pos=-$pid\">$title</a><br/><br/><br/>$desc<p>$keywords</p>";
        print "</description>\n";
print "\t</item>\n";
print "\n";
}
print "</channel>";
print "</rss>";
?>

I get the following errors:

Code: [Select]
This feed does not validate.

line 6, column 40: lastBuildDate must be an RFC-822 date-time: 2008-02-22T14:46:49-06:00 [help]

<lastBuildDate>2008-02-22T14:46:49-06:00</lastBuildDate>                                        ^In addition, interoperability with the widest range of feed readers could be improved by implementing the following recommendation.

line 8, column 0: Missing atom:link with rel="self" [help]

</channel></rss>Source: http://www.sandrailsonly.com/coppermine/rss.php
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel>
<title>Photo &amp; Video Gallery</title>
<link>http://sandrailsonly.com/coppermine</link>
<description>Upload your fav photo; watch killer vids!</description><language>es-MX</language>
<lastBuildDate>2008-02-22T14:46:49-06:00</lastBuildDate>
<generator>Coppermine RSS 2.0 Generator (1.0)</generator>
</channel></rss>

How can I fix this? I tried to fix myself....but then it gave me a parsing error.

Also, it does NOT show up when you visit the site through Mozilla Firefox that there is a feed....

Any help it greatly appreciated. Thanks...
Logged

Nibbler

  • Guest
Re: Get RSS Feeds from Coppermine now!( shows album's title and descriptions)
« Reply #33 on: February 23, 2008, 02:14:27 am »

Change

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

to

Code: [Select]
function lmdate($timestamp)
{
return date('r', $timestamp);
}
Logged

pepemosca

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 25

Here is another code for last upload photos:

Code: [Select]
<?php

//  pepemosca RSS 2.0 Generator
// displays last upload photos via RSS 2.0 feed.
//
//          Copyright (c) 2008 pepemosca
//

define('IN_COPPERMINE'true);
require(
'include/init.inc.php');
$base rtrim($CONFIG['ecards_more_pic_target'], '/');

// Language and settings

$lan_album "Foto del &#38;#225;lbum"//Text before the album name
$lan_archivo "Nombre de archivo"//Text before the file name
$lan_descripcion "Datos de la foto:"//Picture details
$lan_tamano "Tamano de la foto"//Picture size in pixels
$lan_archivotamano "Tamano del archivo"//Picture size in bytes
$lan_hits "Cantidad de veces vista"//Number of hits, seen times
$lan_rating "Puntaje de la foto"//Rating number
$lan_votes1 "con"// with...
$lan_votes2 "votos"//Votes unit
$cantidad 10//How many post to show

// Code

header("Content-type: text/xml; charset=utf-8");
print 
"<?xml version=\"1.0\" encoding=\"utf-8\"?>
\n";
print "<rss version=\"2.0\">\n";
print "<channel>\n";
print "<title>{$CONFIG['gallery_name']} - RSS de los Albumes</title>\n";
print "<link>$base</link>\n";
print "<description>{$CONFIG['gallery_description']}</description>\n";
print "<language>es-AR</language>\n";
print "<category>{$CONFIG['gallery_name']}</category>\n";
print "<lastBuildDate>" . date('D, d M Y H:i:s +0800') . "</lastBuildDate>\n";
print "<copyright>Copyright (c) 2008 pepemosca</copyright>\n";
print "<docs>$base/rss.php</docs>\n";
print "<ttl>10</ttl>\n";
print "<title>{$CONFIG['gallery_name']}</title>\n";
print "<link>$base</link>\n";

//LIMIT 0,*
$result = mysql_query("SELECT pid,aid,filepath,filename,ctime,filesize,hits,pwidth,pheight,pic_rating,votes FROM cpg_pictures ORDER BY pid DESC LIMIT 0,$cantidad");

while(list($pid,$aid,$filepath,$filename,$ctime,$filesize,$hits,$pwidth,$pheight,$pic_rating,$votes) = mysql_fetch_row($result))
{
$result2 = mysql_query("SELECT title FROM cpg_albums WHERE aid=$aid");
list($title) = mysql_fetch_row($result2);
print "\t<item>\n";
print "\t\t<title>$title: $filename</title>\n";
print "\t\t<author>{$CONFIG['gallery_name']}</author>\n";
print "\t\t<link>$base/displayimage.php?pos=-$pid</link>\n";
print "\t\t<description>\n";

print "\t\t<![CDATA[$lan_album &#34;<a href=\"$base/thumbnails.php?album=$aid\">$title</a>&#34;.<br/>]]>\n";
print "\t\t<![CDATA[$lan_archivo &#34;<a href=\"$base/displayimage.php?pos=-$pid\">$filename</a>&#34;.<br/><br/>]]>\n";

print "\t\t<![CDATA[<a href=\"$base/displayimage.php?pos=-$pid\"><img src=\"$base/albums/$filepath" . "thumb_$filename\" alt=\"\" border=\"0px\" /></a>&nbsp;&nbsp;<br/><br/>]]>\n";

print "\t\t<![CDATA[$lan_descripcion<br/><i>]]>\n";
print "\t\t<![CDATA[$lan_tamano &#34;$pwidth x $pheight&#34;.<br/>]]>\n";
print "\t\t<![CDATA[$lan_archivotamano &#34;$filesize bytes&#34;.<br/>]]>\n";
print "\t\t<![CDATA[$lan_hits &#34;$hits&#34;.<br/>]]>\n";
print "\t\t<![CDATA[$lan_rating &#34;$pic_rating&#34; $lan_votes1 &#34;$votes&#34; $lan_votes2.<br/>]]>\n";
print "\t\t<![CDATA[</i><br/>]]>\n";


print "\t\t</description>\n";
print "\t\t<pubDate>" . date('D, d M Y H:i:s +0800', $ctime - date('Z')) . "</pubDate>\n";
print "\t</item>\n";
}

print "</channel>\n";
print "</rss>";
?>
Logged

Shelia

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26

My photos don't have titles and I don't want the view count or the dates to show in the feed. What should I remove from the code to achieve this and what code should I use to embed the feed on a php page?
Logged

onuzu

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34

I tried to install rss.php and I got this error:

--------------------------------
XML Parsing Error: not well-formed
Location: http://lurrenzinc.com/photos/rss.php
Line Number 11, Column 22:   for ( var i = 0; i < links.length; i++ ) {
----------------------------^
------------------------------

The link is http://lurrenzinc.com/photos/rss.php

I need some help
Logged

Nibbler

  • Guest

Either remove this 'XWebMenu' stuff or fix it so it doesn't attach itself to the rss feed.
Logged

Pope-UK

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Get RSS Feeds from Coppermine now!( shows album's title and descriptions)
« Reply #38 on: November 15, 2008, 06:55:54 pm »

This script worked for me, but didn't really seem "right"... so... i've modified it in the following ways:

- new rss channel for each album
- changed channel name to be album name rather than gallery name
- changed channel description to be album description rather than gallery description
- changed author of each image to be the username of the contributor
- changed image title to be the image title rather than album title
- changed image description to be image description rather than album description
- fixed image descriptions... they just seemed to be a mess
- moved the image keywords to their own element

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
//  Modified by Richard Pope pope@vatican-uk.com on 15 November 2008
//
// 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

header("Content-type: text/xml; charset=utf-8");
print 
"<?xml version=\"1.0\" encoding=\"utf-8\"?>
\n";
print "<rss version=\"2.0\">";

$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 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) = 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</item>\n";
print "\n";
}
print "</channel>";
}
print "</rss>";
Logged

meek

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 25
Re: Get RSS Feeds from Coppermine now!( shows album's title and descriptions)
« Reply #39 on: November 16, 2008, 11:31:57 am »

Hi.

How can I modify the script to display all files (or x number of files) from the last created album?

Thanks
Logged
Pages: 1 [2] 3   Go Up
 

Page created in 0.037 seconds with 20 queries.