Easy RSS feed & PicLens - Page 2 Easy RSS feed & PicLens - Page 2
 

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]

Main Menu

Easy RSS feed & PicLens

Started by colinsp, February 17, 2008, 09:58:35 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Nibbler

Read the description. It writes the info out to the file photos.rss.

appsfinder


nuttz

Glad you got it working!!! I didn't think anyone was interested in this so I didn't update the post with the latest script. A few minor tweaks:


  • Took the space out of the XML declaration which sometimes caused an error
  • Formats the XML output
  • Adds the piclens rollover play button to the _normal images as well as the _thumb
  • Added a link to the output to easily view the photos.rss file

I am looking into making this work on a per album basis instead of loading in all the images everytime. If anyone figures this out before I do please post.

Updated code: (also attached)
#!/usr/bin/perl

use CGI::Carp qw( fatalsToBrowser );

print "Content-type: text/html\n\n";

use strict;
use DBI;

my $pos = 0;
my $filestring = "";

my $dbh = DBI->connect ("DBI:mysql:DB-ALBUM", "DB-USERNAME", "DB-PASSWORD", { RaiseError => 1, PrintError => 0});
my $sth = $dbh->prepare ("SELECT filename, filepath, pid FROM DB-PFX_pictures ORDER BY pid DESC");
$sth->execute ();

$filestring .= "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\n";
$filestring .= "<rss xmlns:media=\"http://search.yahoo.com/mrss\" version=\"2.0\">\n";
$filestring .= "\t<channel>\n";

while (my ($filename, $filepath) = $sth->fetchrow_array ())
{
    $filestring .= "\t\t<item>\n";
$filestring .= "\t\t\t<title>$filename</title>\n";
    $filestring .= "\t\t\t<link>displayimage.php?album=lastup&amp;cat=0&amp;pos=";
$filestring .= $pos++;
$filestring .= "</link>\n";
$filestring .= "\t\t\t<media:thumbnail url=\"albums/$filepath"."thumb_$filename\" />\n";
$filestring .= "\t\t\t<media:thumbnail url=\"albums/$filepath"."normal_$filename\" />\n";
$filestring .= "\t\t\t<media:content url=\"albums/$filepath"."$filename\" />\n";
    $filestring .= "\t\t</item>\n";
}

print "<br />";

$dbh->disconnect ();

$filestring .= "\t</channel>\n";
$filestring .= "</rss>\n";

open my $rssfile,  "> photos.rss";
print {$rssfile} $filestring;

print "<a href=\"photos.rss\">View the XML/RSS</a><br /><br />";
print $filestring;

exit;


Again, make sure to edit the 4 previously noted fields.

Enjoy!

appsfinder

Thanks for update will give it a try.

all the Best the-eshop.co.uk

dork313

Wow, I'm so completely confused on this. I really want piclens to work on my site and I'm trying to follow everything correctly but I'm still lost. I don't know how you find out the db-album or how to add more albums, I don't know where to put the .pl file and I don't know how to create the photo.rss file and where it's supposed to go. I've been reading the directions here and on the piclens site and I just can't seem to grasp it. I'm not a total idiot when it comes to web design but I am new to coppermine and piclens and it appears this all going beyond my understanding. Please, please, please break this down some more for me.

Thanks.

colinsp


dork313

Quote from: colinsp on May 28, 2008, 08:27:36 PM
Dork

Have a look at this thread there is another way to do it. http://forum.coppermine-gallery.net/index.php/topic,48819.0.html

Thanks for the tip, I'll be sure to check it out.

radmofo

I'd like to get piclens to work on my site as well but I can't sem to make sense of this. What is it I need to get from piclens website? Does it have to point to the .pl file above on my server? Usually it all makes sense and comes together but I would pretty much like to start over on this rss piclens thing. Does someone care to lend an assist?
Please give me some negative Karma. :)

shiftsrl

Everything should be fine but does not work and I don't know why. I've created the photos.rss file using the perl script, inserted the instructions inside the coppermine template.html file but piclens tell me that the page is not working on my site. I'm behind a proxy so maybe is just a cache problem but I've rebuild the cache and nothing happens.

Someone can tell me how can I check that everything is done right?
Shift Srl
*Link Removed*

Nibbler

Post a link to the photos.rss file.

shiftsrl

ok, my gallery is at http://www.kog.it/album and the rss file is here http://www.kog.it/album/photos.rss

Any suggestion will be appreciated...
Shift Srl
*Link Removed*

Nibbler

Suggestions would be either

1) The file is too large (2.3MB)
2) some files have invalid encoding (eg. 'Festa-5�-Kog-030.jpg' in http://www.kog.it/album/displayimage.php?pos=-4915)

shiftsrl

For the invalid encoding I don't know what to do but I can investigate.

For the file too large problem the solution should be to split it in several parts but question is how big a file should be to be read and how to split it?
Shift Srl
*Link Removed*

shiftsrl

Shift Srl
*Link Removed*

Nibbler

Try adding a limit

my $sth = $dbh->prepare ("SELECT filename, filepath, pid FROM DB-PFX_pictures ORDER BY pid DESC LIMIT 100");

ronronmx

Quote from: nuttz on May 19, 2008, 03:46:26 AM
Glad you got it working!!! I didn't think anyone was interested in this so I didn't update the post with the latest script. A few minor tweaks:


  • Took the space out of the XML declaration which sometimes caused an error
  • Formats the XML output
  • Adds the piclens rollover play button to the _normal images as well as the _thumb
  • Added a link to the output to easily view the photos.rss file

I am looking into making this work on a per album basis instead of loading in all the images everytime. If anyone figures this out before I do please post.

Updated code: (also attached)
#!/usr/bin/perl

use CGI::Carp qw( fatalsToBrowser );

print "Content-type: text/html\n\n";

use strict;
use DBI;

my $pos = 0;
my $filestring = "";

my $dbh = DBI->connect ("DBI:mysql:DB-ALBUM", "DB-USERNAME", "DB-PASSWORD", { RaiseError => 1, PrintError => 0});
my $sth = $dbh->prepare ("SELECT filename, filepath, pid FROM DB-PFX_pictures ORDER BY pid DESC");
$sth->execute ();

$filestring .= "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\n";
$filestring .= "<rss xmlns:media=\"http://search.yahoo.com/mrss\" version=\"2.0\">\n";
$filestring .= "\t<channel>\n";

while (my ($filename, $filepath) = $sth->fetchrow_array ())
{
    $filestring .= "\t\t<item>\n";
$filestring .= "\t\t\t<title>$filename</title>\n";
    $filestring .= "\t\t\t<link>displayimage.php?album=lastup&amp;cat=0&amp;pos=";
$filestring .= $pos++;
$filestring .= "</link>\n";
$filestring .= "\t\t\t<media:thumbnail url=\"albums/$filepath"."thumb_$filename\" />\n";
$filestring .= "\t\t\t<media:thumbnail url=\"albums/$filepath"."normal_$filename\" />\n";
$filestring .= "\t\t\t<media:content url=\"albums/$filepath"."$filename\" />\n";
    $filestring .= "\t\t</item>\n";
}

print "<br />";

$dbh->disconnect ();

$filestring .= "\t</channel>\n";
$filestring .= "</rss>\n";

open my $rssfile,  "> photos.rss";
print {$rssfile} $filestring;

print "<a href=\"photos.rss\">View the XML/RSS</a><br /><br />";
print $filestring;

exit;


Again, make sure to edit the 4 previously noted fields.

Enjoy!

Hi Nuttz,
how can I setup the piclens.pl file to run every day or every time someone uploads a new photo, instead of having to manually run it?
Thx for your contribution btw!

Stephane

Nibbler

See if your webhost provides a cron interface.

ronronmx

Quote from: Nibbler on June 21, 2008, 12:55:44 PM
See if your webhost provides a cron interface.

Oh ok, i think they do. So basically I have to set it up on my server, and I don't have to change any settings in the actual piclens.pl file right?
Sorry for the stupid questions, i am not familiar with this kind of stuff, and thx a lot for your help!

Stephane

shiftsrl

Quote from: Nibbler on June 20, 2008, 05:46:01 PM
Try adding a limit

my $sth = $dbh->prepare ("SELECT filename, filepath, pid FROM DB-PFX_pictures ORDER BY pid DESC LIMIT 100");

You're the best Nibbler. I've tried 100, 200 until 500 and with 500 it works. I think that this is the problem for the people who has many many pictures inside Coppermine.

That way it works!!! Thank you very much!
Shift Srl
*Link Removed*

nuttz

If I ever get the time to work on this again I plan to make it work on a per album basis, so your rss file being to large won't be a problem unless you have thousands of pics in a single album.

If I get time....

As for the cron... no edits are needed to the script. Just set up the time you want it to run. Overnight sometimes is a general rule of thumb.