Changeset 653


Ignore:
Timestamp:
11/14/08 12:11:05 (3 years ago)
Author:
MichaelDaum
Message:

Item176:

Adding a format, header, footer set of format strings to get full
control on how galleries are rendered. This allows integration into other
slideshow tools like  http://www.twospy.com/galleriffic/ or
 http://www.airtightinteractive.com/simpleviewer/examples/small/

Location:
trunk/ImageGalleryPlugin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ImageGalleryPlugin/data/TWiki/ImageGalleryPlugin.txt

    r549 r653  
    1313<tr> 
    1414  <td><img src="%ATTACHURLPATH%/wikiringlogo40x40.png"></td> 
    15   <td><a href="http://wikiring.de" title="Make your Wiki ring!" style="text-decoration:none"> 
     15  <td><a href="http://wikiring.com" title="Make your Wiki ring!" style="text-decoration:none"> 
    1616      Powered by <br /> <nop>WikiRing Consultants </a> 
    1717  </td> 
     
    164164   | *File:* | *Description:* | 
    165165%$MANIFEST% 
    166    * Visit =configure= in your TWiki installation, and enable the plugin in the {Plugins} section. 
     166   * Visit =configure= in your installation, and enable the plugin in the {Plugins} section. 
    167167 
    168168---++ Plugin Info 
     
    172172 
    173173 
    174 |  Plugin Author: | TWiki:Main/MichaelDaum, TWiki:Main/WillNorris | 
     174|  Plugin Author: | Michael Daum, TWiki:Main/WillNorris | 
    175175|  Copyright &copy;: | 2002-2003, Will Norris; 2005-2008, Michael Daum http://michaeldaumconsulting.com | 
    176176|  License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | 
    177 |  Plugin Version: | v3.72 | 
     177|  Plugin Version: | v4.00-per1 | 
    178178|  Change History: | <!-- versions below in reverse order -->&nbsp; | 
     179|  14 Nov 2008 | made format string for galleries more flexible | 
    179180|  16 Jul 2008 | don't crash on images that start with a digits pattern | 
    180181|  07 Jul 2008 | fixing use of string as hash | 
     
    214215|  Other Dependencies: |  | 
    215216|  Perl Version: | 5.8 | 
    216 |  Plugin Home: | TWiki:Plugins/%TOPIC% | 
    217 |  Feedback: | TWiki:Plugins/%TOPIC%Dev | 
    218 |  Appraisal: | TWiki:Plugins/%TOPIC%Appraisal | 
    219  
    220 -- TWiki:Main.MichaelDaum - 16 Jul 2008 
     217|  Plugin Home: | http://nextwiki.org/Extensions/%TOPIC% | 
     218|  Feedback: | http://nextwiki.org/Extensions/%TOPIC%Dev | 
     219 
    221220 
    222221%META:FILEATTACHMENT{name="wikiringlogo40x40.png" attachment="wikiringlogo40x40.png" attr="h" comment="" date="1189787359" path="wikiringlogo40x40.png" size="2571" stream="wikiringlogo40x40.png" tmpFilename="" user="ProjectContributor" version="1"}% 
  • trunk/ImageGalleryPlugin/lib/TWiki/Plugins/ImageGalleryPlugin.pm

    r464 r653  
    1 # Plugin for TWiki Enterprise Collaboration Platform, http://TWiki.org/ 
    2 # 
    31# Copyright (C) 2002-2003 Will Norris. All Rights Reserved. (wbniv@saneasylumstudios.com) 
    42# Copyright (C) 2005-2008 Michael Daum http://michaeldaumconsulting.com 
     
    2624 
    2725$VERSION = '$Rev: 17034 $'; 
    28 $RELEASE = '3.72'; 
     26$RELEASE = '4.00-pre1'; 
    2927$NO_PREFS_IN_TOPIC = 1; 
    3028$SHORTDESCRIPTION = 'Displays image gallery with auto-generated thumbnails from attachments'; 
  • trunk/ImageGalleryPlugin/lib/TWiki/Plugins/ImageGalleryPlugin/Core.pm

    r424 r653  
    1 # 
    2 # TWiki WikiClone ($wikiversion has version info) 
    3 # 
    41# Copyright (C) 2002-2003 Will Norris. All Rights Reserved. (wbniv@saneasylumstudios.com) 
    52# Copyright (C) 2005-2008 Michael Daum http://michaeldaumconsulting.com 
     
    176173  $this->{minwidth} = $params->{minwidth} || 0; 
    177174  $this->{minwidth} = $this->{maxwidth} if $this->{minwidth} > $this->{maxwidth}; 
    178   $this->{format} = $params->{format} ||  
    179       '<a href="$origurl"><img src="$imageurl" title="$comment" width="$width" height="$height"/></a>'; 
     175  $this->{format} = $params->{format}; 
    180176  $this->{title} = $params->{title} || ' $comment ($imgnr/$nrimgs)&nbsp;$reddot'; 
    181177  $this->{doTitles} = ($this->{title} eq 'off')?0:1; 
     
    267263      join(', ', $this->{info}{topics}{value}) ne join(', ', @{$this->{topics}}); 
    268264 
    269   my $result = "<div class=\"igp\"><a name=\"igp$this->{id}\"></a>"; 
     265  my $result; 
    270266 
    271267  # get filename query string 
     
    273269  my $id = $this->{query}->param("id") || ''; 
    274270 
    275   if ($id eq $this->{id} && $filename) { 
    276     # picture mode 
    277     $result .= $this->renderImage($filename); 
     271  if ($this->{format}) { 
     272    $result = $this->renderFormatted(); 
    278273  } else { 
    279     # thumbnails mode 
    280     $result .= $this->renderThumbnails(); 
    281   } 
    282  
    283   $result .= "</div>\n"; 
     274    $result = "<div class=\"igp\"><a name=\"igp$this->{id}\"></a>"; 
     275    if ($id eq $this->{id} && $filename) { 
     276      # picture mode 
     277      $result .= $this->renderImage($filename); 
     278    } else { 
     279      # thumbnails mode 
     280      $result .= $this->renderThumbnails(); 
     281    } 
     282    $result .= "</div>\n"; 
     283    $result = '<noautolink>'.$result.'</noautolink>'; 
     284  } 
     285 
    284286 
    285287  $this->writeInfo(); 
    286   return '<noautolink>'.$result.'</noautolink>'; 
     288 
     289  #writeDebug("result=$result"); 
     290  return $result; 
    287291} 
    288292 
     
    368372 
    369373  # img 
     374  my $imgFormat = '<a href="$origurl"><img src="$imageurl" title="$comment" width="$width" height="$height"/></a>'; 
    370375  $result .= "<tr><td class=\"igpPicture\">"  
    371     . $this->replaceVars($this->{format}, $thisImg); 
     376    . $this->replaceVars($imgFormat, $thisImg); 
    372377 
    373378  # navi 
     
    416421 
    417422# ========================= 
    418 sub renderThumbnails { 
    419  
     423sub renderFormatted { 
    420424  my $this = shift; 
    421  
    422   #writeDebug("renderThumbnails()"); 
     425   
     426  writeDebug("renderFormatted()"); 
    423427 
    424428  if (!@{$this->{images}}) { 
     
    427431 
    428432  my $maxCols = $this->{columns}; 
    429   my $result = "<div class=\"igpThumbNails\"><table class=\"igpThumbNailsTable\"><tr>\n"; 
     433  my $header = $this->{header} || ''; 
     434  my $footer = $this->{footer} || ''; 
     435  my $format = $this->{format} || '   * $imageurl'; 
     436  my $separator = $this->{separator}; 
     437 
     438  $separator = "\n" unless defined $separator; 
     439  my @result; 
     440 
     441  my $imageNr = 0; 
     442  my @rowOfImages = (); 
     443  my $skip = $this->{skip}; 
     444  foreach my $image (@{$this->{images}}) { 
     445 
     446    $skip--; 
     447    next if $skip >= 0; 
     448    last if $this->{limit} && $imageNr >= $this->{limit}; 
     449    $imageNr++; 
     450 
     451    $this->computeImageSize($image); 
     452    if (!$this->createImg($image)) { 
     453      return renderError($this->{errorMsg}); 
     454    } 
     455    if (!$this->createImg($image, 1)) { 
     456      return renderError($this->{errorMsg}); 
     457    } 
     458 
     459 
     460    my $line = $this->replaceVars($format, $image); 
     461    $line =~ s/\$index/$imageNr/g; 
     462    push @result, $line; 
     463     
     464 
     465  } 
     466  return $header.join($separator, @result).$footer; 
     467} 
     468 
     469# ========================= 
     470sub renderThumbnails { 
     471 
     472  my $this = shift; 
     473 
     474  writeDebug("renderThumbnails()"); 
     475 
     476  if (!@{$this->{images}}) { 
     477    return renderError($this->{warn});  
     478  } 
     479 
     480  my $maxCols = $this->{columns}; 
     481  my $result = "<div class='igpThumbNails'><table class='igpThumbNailsTable'><tr>"; 
    430482  my $imageNr = 0; 
    431483  my @rowOfImages = (); 
     
    758810    $format =~ s/\$wikiusername/$image->{user}/gos; 
    759811    $format =~ s/\$username/TWiki::Func::wikiToUserName($image->{user})/geos; 
    760     $format =~ s,\$thumburl,$this->{imagesPubUrl}/thumb_$imageName,gos; 
    761     $format =~ s,\$imageurl,$this->{imagesPubUrl}/$imageName,gos; 
    762     $format =~ s,\$origurl,$image->{IGP_url},gos; 
     812    $format =~ s/\$thumburl/$this->{imagesPubUrl}\/thumb_$imageName/gos; 
     813    $format =~ s/\$imageurl/$this->{imagesPubUrl}\/$imageName/gos; 
     814    $format =~ s/\$origurl/$image->{IGP_url}/gos; 
    763815    $format =~ s/\$web/$image->{IGP_web}/gos; 
    764816    $format =~ s/\$topic/$image->{IGP_topic}/gos; 
     
    9831035} 
    9841036 
    985  
    986  
    98710371; 
Note: See TracChangeset for help on using the changeset viewer.