Difference: ThumbnailPlugin (3 vs. 4)

Revision 42009-01-02 - X509_2fC_3dUS_2fST_3dMassachusetts_2fL_3dSouthborough_2fO_3dlitts_2enet_2fOU_3dLitt_20family_2fOU_3dNetwork_20Administration_2fCN_3dTimothe_20Litt_2femailAddress_3dtimothe_40litts_2enet

Line: 1 to 1
 

ThumbnailPlugin

Thumbnails for everyone

Line: 6 to 6
 

Syntax Rules

Changed:
<
<
%THUMBNAIL{ name="filename" variant="size" }%
>
>

%THUMBNAIL{ name="filename" variant="size" }%

  Given an image file name, returns the name of its thumbnail file of the given size.
Line: 26 to 25
 Used with the AttachLinkPlugin and ImgPlugin, it becomes easy to do things like display hyperlinks to images as thumbnails of that image. Examples below. But if that's what you want, use %THUMBVIEW instead.

Note that the THUMBNAILPLUGIN_ENABLE preference controls thumbnail generation on upload; it does not control expansion of the %THUMBNAIL and %THUMBVIEW variables.

Changed:
<
<
%THUMBVIEW{ name="filename" variant="size" topic="topic" web="web" caption="string" cpos="position" align="string" border="" height="" width="" id="" class=""  link="filename" ltopic="topic" lweb="web" fullpath="" }%
>
>

%THUMBVIEW{ name="filename" variant="size" topic="topic" web="web" caption="string" cpos="position" align="string" border="" height="" width="" id="" class="" link="filename" ltopic="topic" lweb="web" fullpath="" }%

  This is a lot simpler than it looks, as all the defaults are reasonable.
Line: 46 to 44
 
  • fullpath - set to 1 if you want the link references to include the hostname; 0 will just specify the resource. Default is THUMBNAILPLUGIN_FULLPATH, or 0 if undefined.
  • lalign, lborder, lheight, lwidth, lid, lclass - usual HTML tags, applied to the link.
  • lattrs="string" - arbitrary html tag='value' list for the link if you really need that level of control
Added:
>
>

attachutil

 
Added:
>
>
The ThumbnailPlugin distribution also includes attachutil, which is a utility script for manipulating attachments. Although it has special support for ThumbnailPlugin, it is generally useful, especially for refactoring topics. (Perhaps someone would like to package it as a separate Contrib.)
 
Added:
>
>
attachutil is located in the tools directory, and has the following commands:
  • attachutil attach -h -r -c 'comment' web.topic files

    • Attaches listed files to web.topic.
    • -h will mark the files 'hidden' (not shown in the attachment table)
    • -r will replace existing attachment of the same name if it exists
    • -c provides the attachment's comment (shown in the attachment table)
  • attachutil hide web.topic attachments

    • Mark existing attachments as hidden

  • attachutil unhide web.topic attachments
    • Mark existing attachments as visible

  • attachutil list -v web.topic attachments
    • list attachments; default is to list all
    • -v will show thumbnail sizes

  • attachutil move -r web.topic web.topic attachments
    • Move existing attachments from web.topic1 to web.topic 2
    • May specify destination web, topic, or web.topic
    • Default destination is same web, same topic
    • Will move thumbnails

  • attachutil remove web.topic attachments
    • Remove existing attachments from topic
    • Actually, moves them to the configured Trash web, attachment
    • Will add a sequence number if the name already exists in the trash, unless -r is specified.

  • attachutil thumb sizes web.topic attachments
    • Adds sizes (one or more) thumbnails to existing attachments
    • Use when auto thumbnail generation was not enabled at initial upload, or when you need new size(s)
    • sizes are in pixels, space separated list
    • Ignores attachments that are not a known image type

  • attachutil update web.topic attachments
    • Updates file size, date attributes of existing attachments
    • Useful if you've broken the rules and manipulated attachments with non-wiki tools

General rules:

  • Default web is Sandbox - though this may be changed in the future.
  • -v will list each action on stderr
  • -u username will change the (OS) user to username if script is run as root/uid 0.
    • Default is 'apache'
    • Helps keep file ownership correct for thumbnails.
  • -r will replace existing attachment
  • attachment names can be wildcarded (shell-style glob); use shell quotes
  • You can alias (or softlink) any command to save typing.
  This plugin requires the GD and Image::MetaData::JPEG libraries from CPAN.
Line: 87 to 131
 %THUMBVIEW{"foo.jpg" caption="foo revealed"}%

is about as complex as is ordinarily needed.

Added:
>
>
alias attach='/blah/twiki/tools/attachutil attach'
alias list='/blah/twiki/tools/attachutil list'
ln -s /blah/twiki/tools/attachutil hide
attach TestTopic100 *.jpg *.png
list TestTopic100 '*.png'
./hide TestTopic100 'Secret*.png'
/blah/twiki/tools/attachutil thumb 100 200 400 TestTopic100 'My*.png'
 

Plugin Settings

Changed:
<
<
Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %NEWPLUGIN_SHORTDESCRIPTION%
>
>
Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %NEWPLUGIN_SHORTDESCRIPTION%
 
  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Painless links to attachments
Line: 109 to 160
 
data/TWiki/ThumbnailPlugin.txt Plugin topic
data/TWiki/ThumbnailPlugin.txt,v Plugin topic repository
lib/TWiki/Plugins/ThumbnailPlugin.pm Plugin Perl module
Added:
>
>
tools/attachutil Attachment utility
 
  • Configure the Plugin:
    • TWiki 4.0 and up: Run the configure script to enable the Plugin
    • Change the Plugin settings as needed
Line: 116 to 168
 

Plugin Info

Plugin Author: TWiki:Main.TimotheLitt
Changed:
<
<
Copyright: © 2008, TWiki:Main.TimotheLitt
>
>
Copyright: © 2008, 2009, TWiki:Main.TimotheLitt
 
License: GPL (GNU General Public License, Perl artistic)
Changed:
<
<
Plugin Version: 21 Dec 2008 (V1.000)
>
>
Plugin Version: 2 Jan 2009 (V1.1)
 
Change History:
<-- versions below in reverse order -->
Changed:
<
<
20 Dec 2008: Initial version
>
>
02 Jan 2009 V1.1 - Add THUMBVIEW, attachutil, handle per-topic preferences as intended
20 Dec 2008 V1.0 - Initial version
 
TWiki Dependency: $TWiki::Plugins::VERSION 1.1
CPAN Dependencies: GD:: Image::MetaData::JPEG
Other Dependencies: none
Line: 133 to 186
 Related Topics: TWikiPlugins, DeveloperDocumentationCategory, AdminDocumentationCategory, TWikiPreferences http://TWiki.org/cgi-bin/view/Plugins/AttachmentPlugin http://TWiki.org/cgi-bin/view/Plugins/ImgPlugin

-- TWiki:Main.TimotheLitt - 21 Dec 2008

Added:
>
>
-- TWiki:Main.TimotheLitt - 02 Jan 2009
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.ThumbnailPlugin.