Difference: ThumbnailPlugin (2 vs. 3)

Revision 32008-12-28 - 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: 19 to 19
  The thumbnail's size will be determined from the preference variable THUMBNAILPLUGIN_SIZE, which defaults to 150 (pixels).
Added:
>
>
The preference variables can be set in the containing topic, your home topic, the containing web's WebPreferences topic, or the site WebPreferences topics. If a preference is set in multiple places, the value closest to the topic using the plugin will be used.
 Use multiple sizes for accessibility as well as for esthetics. However, they do take time to generate, so don't go too wild.
Changed:
<
<
Used with the AttachLinkPlugin and ImgPlugin, it becomes easy to do things like display hyperlinks to images as thumbnails of that image. Examples below.
>
>
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.

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

  • name - Filename of image to be displayed. Required.
  • variant - Thumnail size to be displayed. Defaults to the first value of the THUMBNAILPLUGIN_SIZE preference variable.
  • topic - the topic to which the image is attached. Defaults to the current topic.
  • web - the web containing the topic to which the image is attached. Defaults to the current web.
  • caption - string to be used to caption the thumbnail. If present, the thumbnail will be displayed within a small table. If not, no caption will be used.
  • cpos - caption position: top, bottom, left or right. Where to position the caption. Default is bottom.
  • align, border, height, width, id, class - usual HTML tags, applied to the thumbnail or the table that contains it.
  • attrs="string" - arbitrary html tag='value' list if you really need that level of control - e.g. onclick= or some such
  • link - filename of attachment to be displayed when the thumbnail image is clicked. Defaults to the name argument (that is, the full size version of the thumbnail)
  • ltopic, lweb - topic & web to which the link target is attached. Default to the topic, web arguments.
  • nolink - set to 1 if you don't want the thumbnail to be clickable.
  • lid, lclass, ltarget, lname - HTML parameters applied (without the leading l) to the link.
  • 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
  This plugin requires the GD and Image::MetaData::JPEG libraries from CPAN.
Line: 52 to 78
  Of course, neither of the previous methods support multiple sizes as easily, nor are they as well abstracted from the attachment implementation.
Added:
>
>
The easiest, and recommended use is:

%THUMBVIEW{"foo.jpg"}%

This will display a default sized thumbnail of foo, making it clickable to the full-sized version.

%THUMBVIEW{"foo.jpg" caption="foo revealed"}%

is about as complex as is ordinarily needed.

 

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %NEWPLUGIN_SHORTDESCRIPTION%

Line: 61 to 97
 
  • THUMBNAILPLUGIN_ENABLE = on, off : enables thumbnail auto-creation on save. Inherits by the usual preference rules.
  • THUMBNAILPLUGIN_SIZE= decimal_number : defines the default size of auto-created thumbnails. You can specify a (space or comma-separated) list, in which case multiple thumbnails (1 of each size) will be generated. The first (or only) size listed is the default variant used by %THUMBNAIL%.
Added:
>
>
  • THUMBNAILPLUGIN_FULLPATH = on, off: default fullpath parameter: on will include hostname (protocol and port) in links; off will not. You may want to set this on a global basis for things like GenPDF.
 

Plugin Installation Instructions

 
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.