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

0 Members and 1 Guest are viewing this topic.

colinsp

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
Easy RSS feed & PicLens
« on: February 17, 2008, 09:58:35 am »

Note from TranzNDance: These posts were split from: Easy RSS feed

Thanks for this plugin I installed it and it works first time out of the box.

Has anyone modded this to make it work with PicLens? Or have any ideas what I would need to do to make it work with PicLens. Unfortunately they don't have a support forum BUT it is a great way of viewing images IMHO.
« Last Edit: February 20, 2008, 08:56:27 pm by TranzNDance »
Logged

VladiczeK

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Easy RSS feed
« Reply #1 on: February 18, 2008, 06:12:13 am »

Actually if you check this link http://takethu.com/thumbnails.php?album=79 of the gallery provided here with easyRSS installed, this mod works with PicLens. But only in particular albums and, what is sad, not in my gallery :-). So it seems that only minor modifications are necessary to make it compatible. Unfortunately, there is no coder interested in PicLens and when it is a client-side software, no support is given. We have to wait when some skilled coder will start to use this great Firefox and IE plugin!

Without response: http://forum.coppermine-gallery.net/index.php?topic=48819.0
Negative response: http://forum.coppermine-gallery.net/index.php?topic=49936.0

Regards
Logged

colinsp

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
Easy RSS feed
« Reply #2 on: February 18, 2008, 07:42:25 am »

Thanks for the reply about PicLens.

With EasyRSS it won't work in my gallery.

The coder of that link you posted has obviously got it working so it sounds like I will have to do some exploration and tweaking to see if I can make it work on my gallery.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Easy RSS feed
« Reply #3 on: February 18, 2008, 08:45:13 am »

The easyRSS feed was designed the way it is. Please keep the PicLens discussion out of this thread.
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Easy RSS feed
« Reply #4 on: February 20, 2008, 07:06:14 pm »

Actually if you check this link http://takethu.com/thumbnails.php?album=79 of the gallery provided here with easyRSS installed, this mod works with PicLens. But only in particular albums and, what is sad, not in my gallery :-). So it seems that only minor modifications are necessary to make it compatible. Unfortunately, there is no coder interested in PicLens and when it is a client-side software, no support is given. We have to wait when some skilled coder will start to use this great Firefox and IE plugin!

Without response: http://forum.coppermine-gallery.net/index.php?topic=48819.0
Negative response: http://forum.coppermine-gallery.net/index.php?topic=49936.0

Regards
I just installed the addon. Can you provide an example where it doesn't work?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Easy RSS feed & PicLens
« Reply #5 on: February 21, 2008, 12:04:34 am »

This is not a contribution, but a plain support thread. Moving accordingly.
Logged

denisjl

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Easy RSS feed & PicLens
« Reply #6 on: March 14, 2008, 01:26:44 pm »

Hi.

Here is my rss.php that works with Piclens:

Code: [Select]
  1 <?php
  2 
// ------------------------------------------------------------------------- //
  
// Coppermine Photo Gallery - RSS Feed                                      //
  
// ------------------------------------------------------------------------- //
  
// Copyright (C) Dr. Tarique Sani                                           //
  
// http://tariquesani.net/                                                  //
  
// modifications by versus7 - www.oixalia.gr - oixalia@oixalia.gr //
  
// further modifications by Brent Gerig
  
// This program is free software; you can redistribute it and/or modify     //
 
10 // it under the terms of the GNU General Public License as published by     //
 
11 // the Free Software Foundation; either version 2 of the License, or        //
 
12 // (at your option) any later version.                                      //
 
13 // ------------------------------------------------------------------------- //
 
14 // Just put into the same directory as your coppermine installation         //
 
15 // ------------------------------------------------------------------------ //
 
16
 17 define
('IN_COPPERMINE'true);
 
18 define('INDEX_PHP'true);
 
19
 20 
global $CONFIG,$ALBUM_SET,$META_ALBUM_SET,$CURRENT_CAT_NAME,$FORBIDDEN_SET_DATA,$lang_plugin_easyrss;
 
21 require('include/init.inc.php');
 
22 require('plugins/Easy_RSS/include/init.inc.php');
 
23
 24 
//How many items you want to show in RSS feed
 
25 $thumb_per_page $CONFIG[plugin_easyrss_num];
 
26
 27 $thumb_count 
0;
 
28 $lower_limit 0;
 
29
 30 
if(count($FORBIDDEN_SET_DATA) > ){
 
31     $forbidden_set_string =" AND aid NOT IN (".implode(","$FORBIDDEN_SET_DATA).")";
 
32 } else {
 
33     $forbidden_set_string '';
 
34 }
 
35
 36 
if(isset($_GET['album'])){
 
37     $album $_GET['album'];
 
38 }
 
39
 40 
//If it is a numeric album get the name and set variables
 
41 if ((is_numeric($album))){
 
42      $album_name_keyword get_album_name($album);
 
43      $CURRENT_CAT_NAME $album_name_keyword['title'];
 
44      $META_ALBUM_SET "AND aid IN (".(int)$_GET['album'].")".$ALBUM_SET;
 
45
 46     $thumb_per_page 
300# Afficher toutes les photos de l'album
 
47
 48      
//Set the album to last uploaded
 
49      $album 'lastup';
 
50 }
 
51
 52 
//If the album is not set set it to lastup - this is the default
 
53 if(!isset($album)){
 
54      $album 'lastup';
 
55 }
 
56
 57 
/*
 58 if ((isset($_GET['cat']) && $_GET['cat'] > 1)){
 59      $cat = $_GET['cat'];
 60      $album_name_keyword = get_album_name($cat);
 61      $CURRENT_CAT_NAME = $album_name_keyword['title'];
 62
 63      $META_ALBUM_SET = "AND aid IN (".$cat.")".$ALBUM_SET;
 64 }
 65 */
 
66
 67 
//Changes these to point to your site if the following is not giving correct results.
 
68 $link_url $CONFIG['ecards_more_pic_target']."displayimage.php?pos=-";
 
69 $image_url $CONFIG['ecards_more_pic_target']."albums/";
 
70
 71 $META_ALBUM_SET 
.= $forbidden_set_string;
 
72
 73 $data 
get_pic_data($album$thumb_count$album_name$lower_limit$thumb_per_page);
 
74
 75 header 
("content-type: text/xml");
 
76 //maybe you must change the encoding to iso-8859-1.
 
77 $rssHeader = <<<EOT
 78 <?xml version="1.0" encoding="iso-8859-7"?>

 79 <rss version="2.0"
 80     xmlns:media="http://search.yahoo.com/mrss/"
 81     xmlns:content="http://purl.org/rss/1.0/modules/content/"
 82     xmlns:wfw="http://wellformedweb.org/CommentAPI/"
 83 >
 84 <channel>
 85     <title>$CONFIG[gallery_name]</title>
 86     <link>$CONFIG[ecards_more_pic_target]</link>
 87     <description>$CONFIG[gallery_description] - $album_name</description>
 88     <generator>$CONFIG[ecards_more_pic_target]rss.php</generator>
 89 EOT;
 90 echo $rssHeader;
 91
 92 foreach($data AS $picture) {
 93
 94     $titlefield = $CONFIG[plugin_easyrss_titlefield];
 95     $caption_text = "<br>".$picture[hits]." ".$lang_plugin_easyrss['views'];
 96     $caption_text .= "<br>".date('M d, Y',$picture[ctime]);
 97
 98     $normal_url = "$image_url$picture[filepath]$CONFIG[normal_pfx]$picture[filename]";
 99     $thumb_url  = "$image_url$picture[filepath]$CONFIG[thumb_pfx]$picture[filename]";
100     $title      = ($picture[$titlefield]?$picture[$titlefield]:$lang_plugin_easyrss['no'].$lang_plugin_easyrss['label_'.$titlefield]    );
101     $keywords = explode(" ",trim($picture[keywords]));
102     $category_string = "";
103     $media_keywords = "";
104     $media_keywords_separator = "";
105     foreach($keywords as $keyword){
106          $category_string .= "<category>$keyword</category>";
107          $media_keywords .= $media_keywords_separator.$keyword;
108          $media_keywords_separator = ', ';
109     }
110     $pubDate = gmdate("D, d M Y H:i:s", $picture[ctime]);
111
112     $description = '<a href="' . $link_url . $picture['pid'] . '"><img src="' . $thumb_url . '" border="1" vspace="2" hspace="2"> <a    lign="center" ></a><br>';
113     if($titlefield == "title")
114         $description .= bb_decode($picture[caption]);
115     $description .= bb_decode($caption_text);
116     $description =  htmlspecialchars($description);
117
118     $item  = '<item>'."\n";
119     $item .= "\t".'<title>'.$title.'</title>'."\n";
120     $item .= "\t".'<link>' . $link_url . $picture[pid] . '</link>'."\n";
121     $item .= "\t".'<pubDate>' .$pubDate.' GMT</pubDate>'."\n";
122     $item .= $category_string."\n";
123     $item .= "\t".'<description>'.$description.'</description>'."\n";
124     $item .= "\t".'<media:title>'.$title.'</media:title>'."\n";
125     $item .= "\t".'<media:description type="html">'.$description.'</media:description>'."\n";
126     $item .= "\t".'<media:keywords>'.$media_keywords.'</media:keywords>'."\n";
127     $item .= "\t".'<media:content url="'.$normal_url.'" />'."\n";
128     $item .= "\t".'<media:thumbnail url="'.$thumb_url.'" />'."\n";
129     $item .= '</item>';
130
131     echo $item;
132 }
133
134 $rssFooter = <<<EOT
135 </channel>
136 </rss>
137 EOT;
138 echo $rssFooter;
139 ?>

I changed the script to display 300pictures instead of 10 when you watch an album (makes piclens to crawl), but didn't find a way to display them all?
If you don't like this behaviour, remove line 46.
Logged

FuzzyD

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Easy RSS feed & PicLens
« Reply #7 on: March 15, 2008, 06:46:42 am »

Excellent denisjl!

Could you by chance attach your modified rss.php as a file to your post?

I seem to be having issues copying and pasting your code.  Thanks for taking the time to do this.  I've been looking forward to using Piclens for coppermine as an optional way to view the galleries. Up until know I've only been able to use Piclens with the last editions rss feed (xfeed)
Logged

FuzzyD

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Easy RSS feed & PicLens
« Reply #8 on: March 15, 2008, 09:11:50 am »

Hello and thanks again denisjl! I apoligize for the double post.  I can't see a way to edit my post to add these additional comments.

I figured out why the copy/paste wasn't working (had to remove the numbers in the front of each line)

I have an issue though.  I don't use intermediate images so I don't have images with the "normal_" prefix used in the rss.php to identify the image for Piclens to expand when zooming, which means that Piclens only shows the thumbs.

I assume this bit of code is what I need to change:

$normal_url = "$image_url$picture[filepath]$CONFIG[normal_pfx]$picture[filename]";
$thumb_url  = "$image_url$picture[filepath]$CONFIG[thumb_pfx]$picture[filename]";

I somehow need to replace "normal_url" and identify that line with my full sized images but the full sized images have no prefix so I'm not sure what to put there.

I tried to create some intermediate images but I want the images as large as possible for viewing in Piclens so when I chose 1200pixels for max height, no intermediate images were created for any image less than 1200 pixels in height so I'm missing half my images in Piclens view.

If there's not an easy way to identify the large images in the lines above, my alternative is to duplicate all of my images (about 9K of them) and add a second set to each album folder which would include the "normal_" prefix.

I figured I'd ask if there was a way to identify the full size images before I did that though : ) It's great to see all of my albums with the Piclens play icon on the thumbs even if I can't see full sized images yet!
Logged

Nibbler

  • Guest
Re: Easy RSS feed & PicLens
« Reply #9 on: March 15, 2008, 03:04:11 pm »

Just remove $CONFIG[normal_pfx] from the code.
Logged

FuzzyD

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Easy RSS feed & PicLens
« Reply #10 on: March 15, 2008, 10:59:48 pm »

Just remove $CONFIG[normal_pfx] from the code.

Thanks!

After that code adjustment, all is working perfect right now with PicLens as an option for viewing in every album.  I left the default at 300 images and don't notice a slowdown but I'm sure a few factors play into that so I'll have some people test it out and report back on performance.
Logged

denisjl

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Easy RSS feed & PicLens
« Reply #11 on: March 17, 2008, 01:53:54 pm »

Thanks for your comments. It looks like contributing isn't as easy as it seems...   ;)

Logged

denisjl

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Easy RSS feed & PicLens
« Reply #12 on: March 17, 2008, 02:07:24 pm »

Here is the file.
Logged

j_taubman

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
    • RJT Photography
Re: Easy RSS feed & PicLens
« Reply #13 on: April 02, 2008, 02:56:43 pm »

Just wanted to say, this is working well for me,  unfortunately I am not much of a php coder,  so was wondering if any one knows how to get it to work on Categories as well as albums.

It looks like this code is the problem,  I know 10000 is the start of user cats,  but I have Cats below this and wanted to use PicLens at that level

Possible code which needs changing around 160 -170 in codebase.php

Code: [Select]
        global $CONFIG;
        $album=$_GET['album'];
        $cat=$_GET['cat'];

if(isset($cat) && $cat < 10000)
    return;

$name = "";
if(is_numeric($album)) {
    $name = get_album_name($album);
    $name = $CONFIG[gallery_name]. " - " . $name['title'];
} else if(isset($cat) && $cat > 0) {
if($cat<10000) {
    $name = easyrss_get_cat_name($cat);
    $name = $CONFIG[gallery_name]. " - " . $name['name'];
} else {
    $name = $CONFIG[gallery_name]. " - " . get_username($cat-10000);
}
Logged

nuttz

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Easy RSS feed & PicLens
« Reply #14 on: April 25, 2008, 07:44:50 pm »

I was  unsuccessful at getting Easy RSS to work with piclens on my site so I wrote my own solution. I wanted to put it out here for those of you who are not having any luck with Easy RSS.

You can see it working here: www.emmonskids.com/gallery

You will need to append your template.html with the piclens code. You can get that on the piclens site.

It's a PERL script that will generate the formatted XML that piclens reads. As of right now it is a manual process, but 100% functional. I am going to update it sometime soon to open and append the .rss file on the server so I can set it as a cron job to be run daily. As of now, you run the script, view the source and copy it to your photos.rss file.

The following assumes you are running the latest version of CPM Gallery:
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 $dbh = DBI->connect ("DBI:mysql:DB-ALBUMNAME", "DB-USERNAME", "DB-PASSWORD", { RaiseError => 1, PrintError => 0});
my $sth = $dbh->prepare ("SELECT filename, filepath, pid FROM DB-PREFIX_pictures ORDER BY pid DESC");
$sth->execute ();

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

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

$dbh->disconnect ();

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

You will need to edit the following 4 items with your database information:
DB-ALBUMNAME
DB-USERNAME
DB-PASSWORD
DB-PREFIX


The script is attached as well. When you put it on your server be sure to chmod it to execute or you'll get an error.

Feedback/suggestions/modifications welcome!
Logged

nuttz

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Easy RSS feed & PicLens
« Reply #15 on: April 25, 2008, 09:48:48 pm »

UPDATE!

The script has been modified to open and overwrite photos.rss. Be sure that photos.rss and piclens.pl are in the same directory. Also make sure photos.rss is writable and piclens.pl is executable.

This script can now be set as a cron job to run at your desired schedule as well as manually, like as soon as you update your gallery.

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 .= " <channel>\n";

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

$dbh->disconnect ();

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

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

Again, be sure to edit the 4 field previously noted.

Enjoy. 
Logged

appsfinder

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Easy RSS feed & PicLens
« Reply #16 on: May 18, 2008, 04:59:33 pm »

UPDATE!

The script has been modified to open and overwrite photos.rss. Be sure that photos.rss and piclens.pl are in the same directory. Also make sure photos.rss is writable and piclens.pl is executable.

This script can now be set as a cron job to run at your desired schedule as well as manually, like as soon as you update your gallery.

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 .= " <channel>\n";

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

$dbh->disconnect ();

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

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

Again, be sure to edit the 4 field previously noted.

Enjoy. 

hi i get this error... Can't connect to data source 'Wide Angle' because I can't work out what driver to use (it doesn't seem to contain a 'dbi:driver:' prefix and the DBI_DRIVER env var is not set) at piclens.pl line 1

what am i doing wrong? ps: can you highlight the code i need to change cheers the-eshop.co.uk
Logged

appsfinder

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

Ok try ed a few thing and now i get this please can anyone help ..........DBI connect('wide angle','admin',...) failed: Access denied for user 'admin'@'localhost' (using password: YES) at piclens.pl line 12
Logged

Nibbler

  • Guest
Re: Easy RSS feed & PicLens
« Reply #18 on: May 18, 2008, 05:31:19 pm »

I guess album name should actually be database name.
Logged

appsfinder

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

I guess album name should actually be database name.

Thanks for that info. changed that now this is no errors: but just a blank page? is this how it works?
Logged
Pages: [1] 2 3 4 5 6   Go Up
 

Page created in 0.117 seconds with 20 queries.