|
Cookbook /
MiniSummary: Simple, lightweight, un-bloated thumbnail and gallery generator
Version: 20100210
Maintainer: Petko
Discussion: Mini-Talk
Users: +17 Contents
DescriptionSimple, lightweight, un-bloated square thumbnail and gallery generator for PmWiki. Mini is a new image gallery and thumbnail generator for PmWiki. It was born out of the well known ThumbList. Mini is used in the place of the PmWiki Attach: markup, but instead of displaying the original picture, a smaller version (thumbnail) is automatically created and displayed, with a link to the original file. ![]() Each thumbnail links to the original picture The main differences from ThumbList are:
See also Mini vs Thumblist2 - discussion at the mailing list. Mini is also compatible with Thumblist : it is possible to use both recipes at the same time. ExamplesYou can edit this page and link your Mini wiki-galleries below.
Installation
This recipe is postcardware. If you like it, you can send me a postcard. Usage in a wiki pageSingle thumbnails and lists:
Galleries of files, attached to a different wiki page:
Thumbnails from other groups or pages are created with the other groups/pages settings. Tooltip titles and captions (both optional):
Thumbnails without links to the originals:
Alternative links to pages/urls instead of to the originals:
List thumbnails in 4 columns, like in a table : >>width=450px<< Mini:* >><< The default thumbnails are 100 px wide, with some padding/margins between them, that's why we set width>400px for the div block. Files not foundIf you list in Removing / regenerating the thumbnailsTo remove all generated thumbnails, use a link Thumbnail sizesThumbnails attached to a page will all have the same dimensions (default: 100x100 pixels). You can change the default size in in a wiki page. Add this directive to your page: (:mini 160x100:) and your thumbnails will be 160px wide and 100px high. The directive will override the Note that the directive concerns only the files that are "uploaded" to the current page. If you have If you add or change the directive, you should purge the old thumbnails with ConfigurationThe following variables can be set in config.php before including the mini.php script. They can also be placed in local configuration files. (You do not need to add a line to config.php in case the default value suits you.) Thumbnail format setting
The full thumbnail specification is in the following format: WIDTHxHEIGHTxCropXxCropYxQUALITYxBGCOLOR With the default values: 100x100x50x50x90xffffff To change the default specification, write in config.php this line: $Mini['thumbs'][0] = '120x120x50x50x90xffffdd'; ![]() Positioning the thumbnailThumbnails are square while original pictures may be rectangle. In this case, the thumbnail will be extracted from a square area in the original picture. By default, this square area is centered in the original picture, but you can change this. In the full thumbnail specification: WIDTHxHEIGHTxCropXxCropYxQUALITYxBGCOLOR the values CropXxCropY represent the position of the cropped area, and vary between 0 and 100 (default both are 50).
LightboxLightbox [1] is an unobtrusive JavaScript used to overlay images on the current page and display them in nice slideshows. And in browsers with JavaScript turned off it simply defaults to linking to the original picture. Here are the configuration settings:
Automatic renaming of filesMini can display only files with simple filenames, that are also displayed by PmWiki's Attach: markup. That means no spaces or special or accented characters, and no uppercase extensions. From version 20090321, Mini can automatically rename an existing file with a wrong filename, to one that is allowed. To enable this, add to config.php this line: $Mini['FixFilenames'] = 1; This will convert the extension to lowercase, spaces to underscores "_", and will strip all problematic characters. Full gallery cacheFrom version 20090104, a full caching of the Mini: galleries in the page can be enabled. It functions like the Thumblist's Supercache feature, however it is simpler and slightly faster. On pages with a huge number of thumbnails like here, the full cache greatly reduces the server/filesystem load and the page displays much more quickly. To enable the full cache, set this line in config.php or in a local customization file: $Mini['EnableCache'] = 1; Note that if you add, delete or re-upload a picture that should appear in a page, you need to re-edit the page so that the cache gets rebuilt. Also note that caching is not designed to work inside or after ConditionalMarkup that modifies the number or the order of the Mini sets. (You can reliably cache only pages displaying the same galleries to every reader.) Title and text around the galleryIt appeared to me that I often need to repeat the tooltip title as a text right before or after the Mini: line: '''Some title text''' Mini:a*.jpg"Some title text" or: Mini:b*.jpg"Some additional text" Some additional text This repetition is annoying and the page source becomes less readable, and more difficult to edit for authors. This was simplified in version 20090201. If you set in config.php Mini:a*.jpg"Title text before|Additional text after" A vertical bar | separates the title header and the footer. Both are not required, use If you don't have a vertical bar in your quoted tooltip, no header or footer are printed. You can style differently the header title and the footer by adding to Rectangle thumbnailsThe default Mini installation produces square thumbnails which are cropped from a square region in the original picture. While squares look and combine better, in some cases, if all pictures are of the same proportions, it may be desirable to have rectangle thumbnails. From version 20090513, it is possible to set in config.php a custom thumbnail size. Examples :
Demos: vertical, horizontal.
Note that all thumbnails attached to the same page will have the same proportions, regardless of the proportions of the originals. If you change the variable These variables can be overridden by the (:mini 160x200:) directive in the wiki page. Custom Mini sets (advanced users)Version 20090513 has new possibilities of customization. Most importantly, you can now have different Mini thumbnails for one picture, by using $Mini['thumbs'][0] = "120x120x50x0x90xffffff"; # For Mini: $Mini['thumbs'][1] = "80x80x50x50"; # For Mini1: # ... # $Mini['thumbs'][9] = "0x128"; # For Mini9: The full thumbnail specification is: WIDTHxHEIGHTxCropXxCropYxQUALITYxBGCOLOR Only the WIDTHxHEIGHT in pixels are required; the other values have default settings. If you set both WIDTH and HEIGHT, the thumbnail will have the exact size. If one of these values is 0, this dimension of the thumbnail will be calculated to be proportional to the other one. For example :
(:mini 120x120:) or (:mini m1=80x80 m2=90x45 m3=141x100 m9=0x128x50x0x90x000000:) In this case, the Recipes for extended featuresMini can be extended via recipes. This allows wiki admins to have more features while keeping the core distribution smaller and simpler.
NotesUnlike ThumbList, Mini does not work with non-standard filenames, unrecognized by the PmWiki core (like: filenames with spaces or uppercase extensions). Mini is only expected to work if the same file can be displayed both with an Attach: link, and in the (:attachlist:) directive. The best way to have "standard" filenames is to upload your files by the PmWiki's ?action=upload function. The thumbnails are stored in the same directory as the original pictures. They are created only once (or if the original pictures are modified). If you change some configuration variable like Like ThumbList, Mini can work with The easiest way to create wiki galleries is to enable uploads "per-page" instead of the PmWiki's default "per-group". See UploadsAdmin and Change Log / Release Notes
See Also
AuthorsMini is written and maintained by Petko. The script is partially based on ThumbList (also by Petko) and on PmWiki's uploads.php script by Pm. Lightbox [2] and its underlying libraries are written by a number of people. See source files for authors and free software licenses. Lightbox was slightly modified by Petko to work with PmWiki directories and the recipes ThumbList and Mini. CommentsYour comments are welcome at Mini-Talk. User ratings / VotesYou can edit this page and add your name. Please don't add a vote (+) or (-) if you already added one in the example galleries linked above.
User notes: If you use, used or reviewed this recipe, you can add your name. The following format is recognized:
* (+) Optional positive comment. Name, date * (-) Optional negative comment. Name, date These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |