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 4 5 6   Go Down

Author Topic: Easy RSS feed & PicLens  (Read 119324 times)

0 Members and 1 Guest are viewing this topic.

Nibbler

  • Guest
Re: Easy RSS feed & PicLens
« Reply #20 on: May 18, 2008, 06:36:45 pm »

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

appsfinder

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Easy RSS feed & PicLens
« Reply #21 on: May 18, 2008, 06:41:58 pm »

Logged

nuttz

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Easy RSS feed & PicLens
« Reply #22 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)
Code: [Select]
#!/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!
Logged

appsfinder

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Easy RSS feed & PicLens
« Reply #23 on: May 19, 2008, 05:39:48 pm »

Thanks for update will give it a try.

all the Best the-eshop.co.uk
Logged

dork313

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
    • NINart
Re: Easy RSS feed & PicLens
« Reply #24 on: May 23, 2008, 12:58:10 am »

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.
Logged

colinsp

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
Re: Easy RSS feed & PicLens
« Reply #25 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
Logged

dork313

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
    • NINart
Re: Easy RSS feed & PicLens
« Reply #26 on: May 29, 2008, 12:26:41 am »

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.
Logged

radmofo

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
Re: Easy RSS feed & PicLens
« Reply #27 on: June 04, 2008, 05:27:57 pm »

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?
Logged
Please give me some negative Karma. :)

shiftsrl

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
    • Apple Reseller
Re: Easy RSS feed & PicLens
« Reply #28 on: June 18, 2008, 06:15:07 pm »

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?
Logged
Shift Srl
 *Link Removed*

Nibbler

  • Guest
Re: Easy RSS feed & PicLens
« Reply #29 on: June 18, 2008, 06:48:29 pm »

Post a link to the photos.rss file.
Logged

shiftsrl

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
    • Apple Reseller
Re: Easy RSS feed & PicLens
« Reply #30 on: June 18, 2008, 11:32:21 pm »

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...
Logged
Shift Srl
 *Link Removed*

Nibbler

  • Guest
Re: Easy RSS feed & PicLens
« Reply #31 on: June 18, 2008, 11:59:16 pm »

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)
Logged

shiftsrl

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
    • Apple Reseller
Re: Easy RSS feed & PicLens
« Reply #32 on: June 19, 2008, 09:30:15 am »

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?
Logged
Shift Srl
 *Link Removed*

shiftsrl

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
    • Apple Reseller
Re: Easy RSS feed & PicLens
« Reply #33 on: June 20, 2008, 05:08:31 pm »

no suggestions!?
Logged
Shift Srl
 *Link Removed*

Nibbler

  • Guest
Re: Easy RSS feed & PicLens
« Reply #34 on: June 20, 2008, 05:46:01 pm »

Try adding a limit

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

ronronmx

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 44
Re: Easy RSS feed & PicLens
« Reply #35 on: June 21, 2008, 10:49:05 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)
Code: [Select]
#!/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
Logged

Nibbler

  • Guest
Re: Easy RSS feed & PicLens
« Reply #36 on: June 21, 2008, 12:55:44 pm »

See if your webhost provides a cron interface.
Logged

ronronmx

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 44
Re: Easy RSS feed & PicLens
« Reply #37 on: June 21, 2008, 06:29:00 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
Logged

shiftsrl

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 74
    • Apple Reseller
Re: Easy RSS feed & PicLens
« Reply #38 on: June 23, 2008, 04:31:33 pm »

Try adding a limit

Code: [Select]
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!
Logged
Shift Srl
 *Link Removed*

nuttz

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Easy RSS feed & PicLens
« Reply #39 on: June 23, 2008, 04:37:06 pm »

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.
Logged
Pages: 1 [2] 3 4 5 6   Go Up
 

Page created in 0.027 seconds with 19 queries.