Easy RSS feed & PicLens - Page 3 Easy RSS feed & PicLens - Page 3
 

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 2 Guests are viewing this topic.

nuttz

Nibbler, do you know if there are any plans to integrate piclens officially?

Nibbler

No plans. Would be better as a plugin than part of the core code.

shiftsrl

Quote from: nuttz 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.

thanks nuttz for the work. I'll wait for the per album release. in the meantime this one works very well  :)
Shift Srl
*Link Removed*

ryback

Hi,

i've installed EasyRSS plugin, replaced rss.php using denisjl's modification.
I found that it's not working if URL is http://www.fotecka.net/rss.PHP?album=91, but if I take a source of URL, put it into file named photos.RSS, than it's OK.
Does anybody know whether Piclens works with .RSS files only?

Thanks
Casey
------------------------
http://www.fotecka.net
http://dino.saur.cz

Iced Coffee

Guy, the thing wrong here is that you capitalized the PHP in rss.PHP:
Quotehttp://www.fotecka.net/rss.PHP?album=91

Just try this http://www.fotecka.net/rss.php?album=91

Iced Coffee

Quote from: denisjl on March 17, 2008, 02:07:24 PM
Here is the file.

I am using Easy RSS plugin and Denisjl's file. PicLens runs fine on my site http://giadinhhanhphuc.net/anhgiadinh/ ; however, there is a problem that though PicLens loaded 300 thumbnails, only 8 first ones (latest pictures) load full size when I zoom in, the others only loaded thumbnail size pictures, therefore, get broken/low resolution when I zoom in. Can any tell me how can I correct it so that all pictures will be loaded correctly? Thanks.

andiwe

OK Guys,

here is my little easy rss mod.
It's running fine on my Gallery so far. I'm sure it has some bugs left in it  :-\
So please give me a hint on what you noticed. If there are security issues please leave me a Note.

My Albums contain thousands of Pictures so loading all pictures at the same time was no option regarding Server CPU-Load and Download Traffic. The mod loads only that many pictures as there are thumbnails in your Album View on one Page (intval($CONFIG[plugin_easyrss_num])).

I added a few  ;) Comments to the Code to give a little Info about what the Code does. Since i am no PHP specialist i'd be glad to hear from you if you have suggestions on what to change.

To get the Plugin working just replace the original Easy_RSS file (rss.php) with my Code. And you need to add the following line to the Template html Headers:
<link id="gallery" rel="alternate" href="rss.php?album=&amp;page=&amp;imgpos=" type="application/rss+xml" title="Image Gallery" />I've done that by the codebase.php with a few more options. But it is not done alone by me, so sorry, i can't give that away, not now.

OK so here's the Code:
<?php 
// ------------------------------------------------------------------------- //
// 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     //
// 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.                                      //
// ------------------------------------------------------------------------- //
// Just put into the same directory as your coppermine installation         //
// ------------------------------------------------------------------------ //
// Mod by Andiwe to generate XML RSS Feed for PicLens Gallery
//  Feed will only load a defined amount of pics at once and give prev an next
//  URL to the Feed for large Album support.
//  Annotations marked with A/

define('IN_COPPERMINE'true);
define('INDEX_PHP'true);

global 
$CONFIG,$ALBUM_SET,$META_ALBUM_SET,$CURRENT_CAT_NAME,$FORBIDDEN_SET_DATA,$lang_plugin_easyrss;
require(
'include/init.inc.php');
require(
'plugins/Easy_RSS/include/init.inc.php');

//How many items you want to show in RSS feed
//A/How many pictures do you want to be loaded at a time ?
//A/Should be the count of pictures in the album View to make the start at a 
//A/ specific Page working.
//A/4 Rows with 5 Colums of Pictures means 20
$thumb_per_page intval($CONFIG[plugin_easyrss_num]);

//A/ We need the count of Pictures in your Movieslide below the preview Image.
//A/ Thats for to make the play Button at the start and end of pages working.
$pics_in_movieslide 5;

//A/URL of your Gallery
//A/$gallery_home_url = 'http://www.yourgalleryhome.de/...../';
$gallery_home_url $CONFIG['ecards_more_pic_target'];

//A/Logo to be displayed on to of the PicLens View
//A/think this is buggy in 3D View but shows correctly in Flash Player (lite)
//A/if you don't wanna have logo or music just comment the hole line out.
//$site_logo = 'http://www.yoursite.de/site_logo.png';
//$site_music = 'plugins/Easy_RSS/site_music.mp3';

//A/set initial values
$thumb_count 0;
$lower_limit 0;
$album '';

if(
count($FORBIDDEN_SET_DATA) > ){
    
$forbidden_set_string =" AND aid NOT IN (".implode(","$FORBIDDEN_SET_DATA).")";
} else {
    
$forbidden_set_string '';
}

if(isset(
$_GET['album'])){
    
$album $_GET['album'];
}

//If it is a numeric album get the name and set variables
if ((is_numeric($album))){
     
$album_name_keyword get_album_name($album);
     
$CURRENT_CAT_NAME $album_name_keyword['title'];
     
$META_ALBUM_SET "AND aid IN (".(int)$_GET['album'].")".$ALBUM_SET;
}
else {

  
//If the album is not set, set it to lastup - this is the default
  
if(!isset($album)){
       
$album 'lastup';
       }
  else {
    if (
$album == 'topn') {
      
//if topviewed is selected
      //$album = 'topn';
    
}
    else {
      if (
$album == 'random') {
      
//$album = 'random');
      
}
      else {
      
//maybe someone injected something else
      
$album 'lastup';
      }
    }
  }
}

//A/ok lets get the correct start point (picture) at wich the rss shall begin
//A/that's when it's called by the prev and next links from piclens
if(isset($_GET['start'])){
    
$start_at_var $_GET['start'];
}
//A/set the lower limit to that point
if ((is_numeric($start_at_var))){
   
$lower_limit intval($start_at_var);  
   
//A/ lets make sure $lower_limit is a multiple of $thumb_per_page
   
$lower_limit = ( (intval(($lower_limit)/($thumb_per_page))) * $thumb_per_page );
}


//A/get the album page from where the feed was loaded
if(isset($_GET['page'])){
    
$start_at_page $_GET['page'];
}
//A/lets define the start lower_limit by a multiple (page) of the thumb_per_page 
if ((is_numeric($start_at_page))){
   
$lower_limit = ((intval($start_at_page) - 1) * $thumb_per_page);  
}


//A/ get the image position when clicking on big preview
if(isset($_GET['imgpos'])){
    
$start_at_imgpos $_GET['imgpos'];
}
//A/set the lower limit to that point
if ((is_numeric($start_at_imgpos))){

//A/try to reduce that to the cases where those overlapping pictures are displayed
//$pics_in_movieslide = 5; // =5
      
$movieslideleft intval(($pics_in_movieslide -1) / 2); // =2
      
$moviesliderest $pics_in_movieslide $movieslideleft// =3
      
   
if ($start_at_imgpos < ($thumb_per_page)) {
      
$lower_limit 0;
      if ( ( (
$start_at_imgpos $thumb_per_page) > ($thumb_per_page $moviesliderest) ) ) {
      
//Awe got overlapping picture on the first page
      
$thumb_per_page_multi 2;
      
$thumb_per_page $thumb_per_page_multi $thumb_per_page;  
      }
   }
   else {
      
$lower_limit = ( (intval(($start_at_imgpos)/($thumb_per_page))) * $thumb_per_page );
      
//A/sorry we got to load more pictures to show all play buttons on the thumbnails
      //A/in preview. especially when in the movie-clip view there are pictures that are
      //A/not on the same page with the viewed image, the button won't be displayed
      //A/because the feed doesn't contain that datasets.
      
      
if ( (($start_at_imgpos $thumb_per_page) < $movieslideleft) ) {
      
//A/we got overlapping pictures at the start of a page
      
$lower_limit $lower_limit $thumb_per_page;
      
$thumb_per_page_multi 2;
      
$thumb_per_page $thumb_per_page_multi $thumb_per_page;      
      }
      if ((
$start_at_imgpos $thumb_per_page) > ($thumb_per_page $moviesliderest) ) {
      
//A/we got overlapping pictures at the end of a page
      
$thumb_per_page_multi 2;
      
$thumb_per_page $thumb_per_page_multi $thumb_per_page;      
      }
      
//A/no overlapping pictures and nothing to do ;-)
      
      //A/so now we have got to make sure that we can set the previous and next feed links
      //A/correctly we will do that when it comes to generate the links.
      //A/therefor we reset the $thumb_per_page to it's original value when it comes
      //A/to the url generation in next oder prev cases.
   
}  
}


//Changes these to point to your site if the following is not giving correct results.
$link_url $CONFIG['ecards_more_pic_target']."displayimage.php?pos=-";
$link_url_alb $CONFIG['ecards_more_pic_target']."displayimage.php?album=";

//A/Choose between Full Path and relative one depending on where this file resides.
//A/relative one is shorter and makes smaller rss feeds.
//$image_url = $CONFIG['ecards_more_pic_target']."albums/";
$image_url "albums/";

$META_ALBUM_SET .= $forbidden_set_string;
$data get_pic_data($album$thumb_count$album_name$lower_limit$thumb_per_page);

/*
//A/we wan't to have linkback to the correct album id and not the absolute picture pos
//A/if we are have not opened the feed out of an album but a cat like e.g. lastup instead
if $start_at_imgpos < 0 {

}
*/

header ("content-type: text/xml");
//A/we need less code than easy rss what makes the rss smaller
$rssHeader = <<<EOT
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>

EOT;

$rssHeader .= <<<EOT
<generator>Easy RSS Feed Mod 4 PicLens by Andiwe</generator>

EOT;
/*
$rssHeader .= <<<EOT
<title></title>
<link></link>
<description></description>

EOT;*/

echo $rssHeader;


//A/ ok lets create the "previous" and "next" links in the rss feed
//A/ the if construction needs to be sorted ... that sure was some alcoholic stuff ;-)

  $item = '';

if ($thumb_count > $thumb_per_page)  {
//A/ so we got to make sure that the album has more pictures than $thumb_per_page
//A/ if it has less we do not need any links
 
  if ($lower_limit < $thumb_per_page) {
  //A/ so we are at the start of the gallery and need only a next link
  $nextfeednum = $thumb_per_page;
  $item .= '<atom:link rel="next" href="rss.php?album='.$album.'&amp;start='.$nextfeednum.'" />';
  $item .= "\n";
  }

if (($thumb_count - $lower_limit) > $thumb_per_page)  {
//A/ so we are anywhere in the middle of the gallery

  if ($lower_limit > ($thumb_per_page - 1)) {
  //A/ just check again if we are not at the start ... why ??? don't know anymore ;-)
  $nextfeednum = $lower_limit + $thumb_per_page;
  if ($thumb_per_page_multi > 1) {
      $thumb_per_page = $thumb_per_page / $thumb_per_page_multi;
  }
  $previousfeednum = $lower_limit - $thumb_per_page;
  $item .= '<atom:link rel="previous" href="rss.php?album='.$album.'&amp;start='.$previousfeednum.'" />';
  $item .= '<atom:link rel="next" href="rss.php?album='.$album.'&amp;start='.$nextfeednum.'" />';
  }
 
  if ($lower_limit > ($thumb_count - $thumb_per_page)) {
  //A/ so what was this for ???
  if ($thumb_per_page_multi > 1) {
      $thumb_per_page = $thumb_per_page / $thumb_per_page_multi;
  }
  $previousfeednum = $lower_limit;
  $item .= '<atom:link rel="previous" href="rss.php?album='.$album.'&amp;start='.$previousfeednum.'" />';
  }
 
}

if (($thumb_count - $lower_limit) < ($thumb_per_page + 1))  {
//A/ we are at the end of the gallery because there are less or equal than $thumb_per_page images left
//A/ so just create a previous link
  if ($lower_limit > ($thumb_count - $thumb_per_page)) {
    if ($thumb_per_page_multi > 1) {
      $thumb_per_page = $thumb_per_page / $thumb_per_page_multi;
    }
    $previousfeednum = $lower_limit - $thumb_per_page;
    $item .= '<atom:link rel="previous" href="rss.php?album='.$album.'&amp;start='.$previousfeednum.'" />';
  }
}

}

  echo $item;
 
//A/ prev and next feed links maybe ;-) have now been generated.

//A/ we've lost some Easy_RSS Code here ;-)

$rssHeader = '';

if ($site_logo > '') {
  $rssHeader .= <<<EOT
<atom:icon>$site_logo</atom:icon>

EOT;
}

if ($site_music > '') {
  $rssHeader .= <<<EOT
<atom:link rel="enclosure" type="audio/mpeg" length="1337" href="$site_music" />

EOT;
}


echo $rssHeader;
echo "\n";

//A/ i replaced the thumbnails with the normals and the normals with the full sized pics
//A/ thumbnails are looking bad in wall view
//A/ linking in the picture by the icon doesn't work anymore with that option :-(

//A/ as you can see i now have 2 thumbnail urls
//A/ only the first will be used to load the pictures
//A/ the second one is to publish the real thumbnail filenames to piclens
//A/ without that the play button won't appear in the thumbs in album view.
$tmp_count = $lower_limit;

foreach($data AS $picture) {
  $full_url = "$image_url$picture[filepath]$picture[filename]";
  $normal_url = "$image_url$picture[filepath]$CONFIG[normal_pfx]$picture[filename]";
  $thumb_url  = "$image_url$picture[filepath]$CONFIG[thumb_pfx]$picture[filename]";
  $title      = $picture[filename];
  $picmd5     = getGuid(md5($picture[pid]));
  $item  = '<item>';
  $item .= "\n";
$item .= '<title>'.$title.'</title>';
$item .= "\n";

  //following line is for debugging only
//$item .= '<title>'.$title.'-'.$album.'-'.$album_name_keyword.'-'.$lower_limit.'-'.$thumb_count.'-'.$lower_limit.'-'.$start_at_imgpos.'-'.$start_at_page.'-Mod'.$start_at_imgpos % $thumb_per_page.'</title>';
 
  if ((is_numeric($album))) {
  $item .= '<link>' .$link_url_alb . $picture[aid] . '&amp;pos='. $tmp_count . '</link>';
  $item .= "\n";
$tmp_count = $tmp_count + 1;
  }
  else {
  $item .= '<link>' .$link_url . $picture[pid]. '</link>';
  $item .= "\n";
  }
 
  $item .= "<guid>".$picmd5."</guid>\n";
  $item .= '<media:thumbnail url="'.$normal_url.'" />';
  $item .= "\n";
  $item .= '<media:thumbnail url="'.$thumb_url.'" />';
  $item .= "\n";
  //$item .= '<media:content url="'.$normal_url.'" type="" />';
$item .= '<media:content url="'.$full_url.'" type="" />';
$item .= "\n";
$item .= "</item>\n";
  $item .= "\n";
    echo $item;
}

$rssFooter = <<<EOT
</channel>\n
</rss>
EOT;
echo $rssFooter;

$album = 'lastup';
?>


Andi

--- for Cooliris Piclens CPG Plugin (Easy RSS Mod) check out my Website Link ---

andiwe

Quote from: andiwe on August 13, 2008, 08:11:20 PM
...The mod loads only that many pictures as there are thumbnails in your Album View on one Page (intval($CONFIG[plugin_easyrss_num])).
So the rss feed is very small. If you enter the Piclens Application it will load all Images of e.g. the current Album as you start moving "the wall".

This makes it possible to start PicLens with "lastup" and scroll through ALL pictures in your CPG installation (ATM ~20.000 on one of mine).

So far it's working for Lastup, Topn (most viewed) and per Album.
If you're in Cat or e.g. Lastcom (comments) it will show you to the Lastup feed.

Quote from: andiwe on August 13, 2008, 08:11:20 PMTo get the Plugin working just replace the original Easy_RSS file (rss.php) with my Code. And you need to add the following line to the Template html Headers:
<link id="gallery" rel="alternate" href="rss.php?album=&amp;page=&amp;imgpos=" type="application/rss+xml" title="Image Gallery" />I've done that by the codebase.php with a few more options. But it is not done alone by me, so sorry, i can't give that away, not now.

Sorry that was #*!&$*#  ;)

Please modify the codebase.php this way: Remove the function easyrss_header and replace it with the following:
function easyrss_header() {
    global $CONFIG,$lang_plugin_easyrss;
    require ('plugins/Easy_RSS/include/init.inc.php');

//A/ so here is the Header for PicLens
    $add_header_info = "";
//    $add_header_info = "<!-- Step 1: Add a Photos RSS feed to this webpage. //-->";
    $add_header_info .= "\n<link id=\"gallery\" rel=\"alternate\" href=\"rss.php?album=".$_GET['album']."&amp;page=".$_GET['page']."&amp;imgpos=".$_GET['pos']."\" type=\"application/rss+xml\" title=\"Image Gallery\" />";
//    $add_header_info .= "\n<!-- Step 2: Include the PiclensLite JavaScript. //-->";
    $add_header_info .= "\n<script type=\"text/javascript\" src=\"http://lite.piclens.com/current/piclens_optimized.js\">";
    $add_header_info .= "</script>\n<style type=\"text/css\"> .mbf-item {display:none;} </style>".$otherHead;
    return $add_header_info;
}

Notice the page and imgpos ... that is for jumping directly to the correct Feed-Part and showing up the Picture you have clicked on.

And finally here is the rss.php as attached file.

Andi

--- for Cooliris Piclens CPG Plugin (Easy RSS Mod) check out my Website Link ---

snark

Hi,

I installed Easy RSS, modified codebase.php with the new easyrss_header() and installed your rss.php file at the root of my gallery.

When I try to access the rss feed, I get a PHP error:
XML Parsing Error: no element found
Location: http://photos.reichertonline.be/rss.php?album=42&page=&imgpos=0
Line Number 6, Column 1:


Any idea what is wrong?

Thanks!

Iced Coffee

Yes, I was found the same error though I used the previous version (I downloaded 1 month ago I think) and it was fine.
QuoteXML Parsing Error: no element found
Location: http://giadinhhanhphuc.net/anhgiadinh/rss.php
Line Number 10, Column 1:

I've just re-uploaded the previous version and it is working well now. So, what's wrong with this new version?

snark

Quote from: Iced Coffee on August 19, 2008, 09:24:26 AMI've just re-uploaded the previous version and it is working well now. So, what's wrong with this new version?
Can you please post the previous version or make it available somewhere for download? Thanks!

Iced Coffee

Here it is in this zip file

andiwe

Please replace Line 34 in rss.php
$thumb_per_page = intval($CONFIG[plugin_easyrss_num]);

with:

$thumb_per_page = ##
Where ## should be the Number of Thumbnails in your album view.
e.G. if your Thumbail View is 4x5 Pictures the Number is 20

Did this work ?
Andi

--- for Cooliris Piclens CPG Plugin (Easy RSS Mod) check out my Website Link ---

andiwe

Don't forget the ; at the end of the line  ;)
Andi

--- for Cooliris Piclens CPG Plugin (Easy RSS Mod) check out my Website Link ---

snark

Yes, I tried changing that value already (with the ; at the end  ;) ) but no success.

snark

BTW andiwe, I checked the RSS feed on your gallery. Is it normal you have 2 media:thumbnail elements per item??? I don't think so.

snark

I found the error in rss.php. The error displayed in the browser is actually not in the PHP file, but in the generated XML feed.

To solve the error, change line 305 in rss.php from
$picmd5     = getGuid(md5($picture[pid]));
to
$picmd5     = md5($picture[pid]);

I'm not sure if there are any side effects to this change. PicLens works fine in my gallery with this fix.

Let me know about yours.

andiwe

to be honest, i don't know really what effect the md5 sums have for piclens. i just saw them being generated by the original software. i could not recognize any difference until now. thanks for the fix, i will try this weekend.

the thing with the 2 thumb urls is following:

//A/ i replaced the thumbnails with the normals and the normals with the full sized pics
//A/ thumbnails are looking bad in wall view
//A/ linking in the picture by the icon doesn't work anymore with that option :-(

//A/ as you can see i now have 2 thumbnail urls
//A/ only the first will be used to load the pictures
//A/ the second one is to publish the real thumbnail filenames to piclens
//A/ without that the play button won't appear in the thumbs in album view.

just change it to your needs  ;D

BTW: what $thumb_per_page value did you use in your galery ? 25 should be fine, perhaps decrease your value to that to make the play buttons on further thumbnail pages visible.

Andi

--- for Cooliris Piclens CPG Plugin (Easy RSS Mod) check out my Website Link ---

snark

Quote from: andiwe on August 20, 2008, 10:22:54 PMjust change it to your needs  ;D
OK, thanks for pointing to the explanation. It works great like that and makes browsing my albums a real pleasure!

Quote from: andiwe on August 20, 2008, 10:22:54 PMBTW: what $thumb_per_page value did you use in your galery ? 25 should be fine, perhaps decrease your value to that to make the play buttons on further thumbnail pages visible.
Yes, I just set it to 25, the number of images per page in my albums.

Iced Coffee

So can anyone post the final version of the rss file? Is there any difference between this one and the one I attached in the earlier post? Thanks.