What's new in version 2

This was written in November 2007. --Petko

Thumblist² is a totally rewritten program, quite different from the original Thumblist recipe, and this is the reason there had to be some changes in the parameters and configurations. I believe it is for the greater good.

The first version of Thumblist was published exactly one year ago. It could do only the really basic tasks for image processing. Over the time users have made many good suggestions which were incorporated in the core.

The first Thumblist, in its last days, can be compared to an old castle: built in different centuries, constantly added and repaired, with different building techniques to answer to different needs of the different users. Complicated to understand, expensive to maintain (time is money), almost impossible to customize its core behavior, somehow bloated as it contained features that only a few users would use.

I learned a lot from writing and maintaining this script. I am also a big fan of the PmWiki principles: almost every function in the code can be modified, customized or replaced without causing the whole program to break on upgrades.

As more and more people want additional features in the Thumblist, I decided to completely rewrite the script, so that everyone will be able to adapt it for their needs. Instead of having an enormous program that does every possible thing found in online gallery software, Thumblist² is rather accepting of every possible modification.

The new version is extremely flexible. It is fully configurable and all components are replaceable and extendable by user-defined ones : templates, ordering, user-defined swappable and derivable functions (much more in the spirit of PmWiki). It is possible and easy to write recipes/plug-ins modifying most aspects of your galleries.

How to upgrade

  • Copy your existing thumblist.php file somewhere safe, in case the new version doesn't work.
  • Download the files and copy them to your /cookbook/ directory.
  • In your config.php, at the place where you had previously:
    include_once("$FarmD/cookbook/thumblist.php"); you need to change it to:

Changes from Ye Olde Version

  • Threaded processing is the only mode for creating thumbnails. It proved to work better, having less problems related to the max_execution_time and memory_limit. Coincidently, the $ThumbList['Thread'] variable was removed.
  • limit= and start= are both replaced by count=. It works like PmWiki's pagelists, except that it only accepts positive numbers. count=10 or count=..10 or count=1..10 means thumbnails from 1 to 10; count=5..10 means the six thumbnails from 5 to 10; count=10.. means thumbnails from 10 to the end.
    • The $ThumbList['Limit'] variable was removed.
  • shuffle=1 is replaced with order=random, because now there are several sorting orders.
  • The target= parameter was removed. You can now modify the snippet $ThumbList['_tmpl']['awrap'] to include a target attribute in your links, see Fine tuning HTML.
  • The maxarea= parameter and the $ThumbList['MaxArea'] variable were removed. In case you need these checks, we will provide a recipe to do them.
  • All former "Percent variables" are now known as "Question variables" (use ? instead of %). The reason for this change was that it interfered with both the PmWiki %styles% definitions and with the sprintf function which is now used to parse the HTML snippets and these variables. (There are by the way some new variables; the bracket-percent variables in ImageMagick's command line stay.)
  • The variable $ThumbList['RedoThumbs'] was removed. It was requested by one user, but complicated the program. If there is a demonstrated need to always/never redo the thumbnails other than for debugging, a recipe will be written.
  • Lightbox integration has changed. It is now more clever and flexible, and loaded automatically, but will require you to update your settings which have changed for Thumblist². See Lightbox.
  • The parameter captioncss=1 and the variables $ThumbList['InlineCaptionCSS'] and $ThumbList['icapContainer'] were removed. The same features can now be achieved better by editing the $ThumbList['_tmpl'] array, and are shown at Fine tuning HTML and at Sandbox 4.
  • The variables $ThumbList['LinkAdd'] and $ThumbList['Add'] were removed, as the same features can now be done by changing the snippets in the $ThumbList['_tmpl'] array.

Note that the most popular existing configurations from the old version (start=, limit=, shuffle= and the Percent variables in titlefmt= and captionfmt=) will be recovered by Thumblist², so your galleries should still work, but in some long time, support for these may be dropped by future versions of Thumblist².

If you have any questions or difficulties upgrading, don't hesitate to ask us.

Now, the cool stuff:

  • The parameter link=2 made it possible for the thumbnails to link not to the original pictures, but to the wiki page with the full gallery. Now it is possible to link to any wiki page if you set its full name: link=Photos.Paris2007. (Full Group.Name is required.) See Alternative links.
  • The parameter tlmode=1 converted a thumbgallery into a thumblist, which was usefull if the hand-written filelist was not complete. Now, with tlmode=2 all file names will be listed, ordered and formatted, so you can just copy it and then paste it in the wiki page. It should be much easier editing it. See tlmode.
  • We can at last sort/order the file list, by: name, extension, time, file size, width, height and ratio. See Order. We can also write additional ordering functions.
  • Every HTML snippet wrapping the thumblist can be now changed. See Fine tuning HTML.
  • Most of the work is split into external functions that can be replaced/modified.
  • The functions for creating and purging thumbnails, and template trails are now in an external file only loaded when it is needed.

Writing recipes and custom functions

Reading the Thumblist² code will probably be enough to understand how every function works and how it can be replaced or extended. I will explain better later. I want to set here one guideline for developers writing recipes and customizations.

If you write a custom function, please name it to begin with "function uThumb*()", like the one used for Lightbox. Current Thumblist² functions all start with "Thumb*", "uThumb" means "User function for Thumblist" and will avoid problems if in the future the Thumblist² core acquires a similar function.

If you are using the $ThumbList array to store your own data and configurations, please, use array keys starting with "u", for the same reason.