ThumbList-Talk-archive

Summary: ARCHIVE Talk Page for ThumbList recipe
Maintainer: Petko
Categories: Images, Uploads

Back to Cookbook.Thumb list

This is an archive of the ThumbList Talk page. Please post your new questions to ThumbList-Talk.

Changelog for Thumblist version 1, up to 2007-11-20

2007-11-20

  • Removed exif=1 and $ThumbList['EnableExif']. If any of the listed EXIF percent variables are requested and your PHP contains the function "exif_read_data", EXIF data is automatically extracted. Better Template trails if the site has not set any ImageTemplate.

2007-10-22

  • Documented the captioncss/InlineCaptionCSS variables, added icapContainer, htmlpx; Allow robots to index gallery trails (suggested by gnuzoo; to disable this, set $RobotActions['imgtpl']=0; in config.php).

2007-09-17

  • Added link=2 parameter, for an often requested feature to link to the gallery page instead of to the original file. Fixed inconsistency inside ImageTemplates when $ThumbList['UseTmpl'] is set to 1 and the template contains another thumb(list) command.

2007-08-27

  • Added $ThumbList['tlmode'], other minor additions.

2007-08-26

  • Minor code cleanup; rm notice warning when exif is disabled; fixed bug with {*$PrevThumb} when the filename contains spaces.

2007-08-19 Major release, important changes

  • All Administrator config variables are now changed and contained inside a big array $ThumbList (suggested by Dfaure). The script may recover a prevoius configuration but you are urged to change your settings to the new format before 2008.
  • added quiet=0 parameter
  • added {$PrevThumb}, {$NextThumb} page variables in "usetemplate" mode, and $ThumbList['TrailPx'] for setting their height.

2007-08-02, 2007-08-02a

  • Threaded mode is now enabled by default for new installations. To disable it, set in config.php $ThumbThread=0;.
  • ThumbList is now distributed with the GNU General Public License version 3.
  • ImageMagick : added quotes to commandline args.

2007-08-01

  • ImageMagick : fix command line if filename has spaces and abort with a message on error.

2007-07-29

  • Possibility to use ImageMagick's convert instead of GD. Fix caching instructions with $EnableIMSCache.

2007-05-16

  • New admin variable $ThumbAllowedUploadPages, replaces $ThumbSamePageOnly (removed) as the new one is much more powerful.

2007-05-14

  • In thumb and thumbgallery mode, if the files do not exist, the Attach: links will contain the filename and the caption (if set).

2007-05-04

  • New admin variable $ThumbPurgeRedirectFmt; relative urls are enabled by $EnableLinkPageRelative which appeared in PmWiki 2.2.0-beta45.

2007-05-01

  • Supercache now accepts manual IDs in order to properly store lists inside conditionnal expressions. Added admin variable $ThumbSamePageOnly.

2007-03-21, 2007-03-21a

  • Added $ThumbAttachLinks administrator variable.

2007-03-18

  • Improvement: in thumbgallery mode, will show "Attach:" links if the upload directory does not exist.

2007-03-15

  • Fixed problem with custom auth-levels different from read/upload/edit; fixed minor issues when PageTextVariables control the thumblist (see talk page); fixed a small problem with the image-trail caching (was cached more often than needed).

2007-02-26

  • Fixed a recently introduced bug with template trails.

2007-02-02

  • Fixed a minor error in case of updated big pictures and existing (older) thumbnails, in threaded mode (the bug would cause the thumbnail to be recreated twice if two visitors open the page at the same second; subsequent page loads were not affected).

2007-02-01, 2007-02-01a

  • If a file is not found, Attach: links are displayed, so one can easily upload the files (for the "thumb" and "thumbgallery" markups).

2007-01-20

  • Image template trail bugfix; shuffle mode fixes

2007-01-19 (not released)

  • shuffle mode tests (shuffle=1)

2007-01-18, 2007-01-18a, 2007-01-18b

  • Fixed bug when the function "exif_read_data" is not available

2007-01-16a

  • Fixed bug with $ThumbLinkAdd.

2007-01-16

  • Fixed bug when the filename contains spaces.

2007-01-14 (many changes)

  • Changed admin variables $AlwaysRedoThumbs to $ThumbRedoThumbs and $AlwaysLinkOriginal to $ThumbLinkOriginal.
  • Default JPEG quality changed from 80% to 90% (better looking galleries).
  • ImageTemplate trails: new page variables {$PrevLink}, {$NextLink}. Added admin vars $ThumbPrevLink and $ThumbNextLink.
  • Single thumbnail with captionfmt is transformed in a one-table cell.
  • Combined ThumbGallery in "ThumbList mode" (parameter tlmode=1)
  • Parameter link=
  • New page variables in the ImageTemplates: like the percent-variables

2007-01-10

  • Fixed an htmlspecialchars error for the %N variable.

2007-01-09a

  • Added percent-variables %n, %N, %u and %U (for very advanced users).

2007-01-09

  • Transparency bugfix, several changes and code cleanup, added file types .WBMP and .XMP; the JPEG thumbnail filenames are now independent from the bgcolor (as this format does not support transparency) and are not regenerated if the page bgcolor changes.

2007-01-04

  • Development release, added ThumbGallery, EXIF (very basic), single image captions, warning messages, GD-none-1-2 test (very simple).

2006-12-31

  • Threaded thumbnail generation (activated with $ThumbThread = 1;), first the page structure is displayed, then, every thumbnail is created with a separate PmWiki process. This should avoid most time or memory issues with too big or too many files.

2006-12-28a:

  • an error was fixed for the maxarea parameter

2006-12-28 (lots of changes):

  • added variables $ThumbMaxArea, $ThumbLinkAdd, $ThumbAdd, and %G for the latter two and the titlefmt parameter
  • added parameter width= for single thumbnails
  • only files with extensions JPG, JPEG, GIF and PNG are now examined (should run much faster if you have other files, like .txt or .zip uploaded)
  • changed the default thumbnail "alt" attribute to match the "titlefmt" parameter
  • after an action "purgethumbs", the "upload" page is shown, not the page itself (there is the list of the files, you can see how thumbnails are removed)
  • new page variable {$UpFilePage}

2006-12-27:

  • A division-by-zero bug was fixed, when the thumbnails are not inside a table.

2006-12-17:

  • added name=pattern, removed prefix= and ext=.

2006-12-15:

  • Trimmed down the CreateThumb function: does the same job, but with about twice less memory load for PNGs and transparent GIFs.

2006-12-14. This version has adds some important features:

  • if the page links to another page's uploads (:thumblist Group.Page:), checks for read permissions at that other page
  • added skip="a*.jp*g", usetemplate=1; new variables $AlwaysRedoThumbs, $AlwaysLinkOriginal, $ThumbListUseTmpl
  • old file versions (it this is enabled) are now skipped
  • the code is now licensed GNU GPL (because of the inclusion of GPL'd code) and is 10.5k (bigger than before).

2006-12-12

  • Initial release of the recipe on PmWiki.org

Creeping featurism

Thank you all for your ideas and suggestions on how to improve the thumb list recipe, that I received here or by e-mail. I am considering every one for inclusion.

However, my intention was (and still is) to write an easy, fast and simple script that lists attached images, without complicating things. Consider it an extension of the (:attachlist:) directive. More features means more code, more server load, more bugs, more documentation to write, more user support (because it is too complicated and difficult). Sometimes less is more. See the article Creeping featurism, our script is now much more complex than I intended. From 8 kB, the script is now more than 11!

Some of the proposed features require opening external pages to extract variables or comments. This can be really slow on a shared hosting, because PmWiki has to check Group and page permissions and read the external page for every thumbnail -- if you have 40-50 per page, this may even not work (Supercache cannot help because it will never be up-to-date).

Note that with the "Image templates" you can include other pages, or extract variables, or set a comments feature, for the currently displayed picture, using the variables {$UpFilePage}, {$UpDir}, etc. There are fine recipes that can do this. You can have very flexible configurations, just need to plan them well (then post them here to help others).

About extracting metadata from the pictures, or worse, modifying it, currently much of these things are not really stable and interoperable: the usable scripts able to do this are almost 1 megabyte of code, or require PHP 5.1. Besides, extracting metadata will make things slower. One can implement a recipe that will try to read such metadata on one individual image at a time, but it will be a different script. It can then collaborate with ThumbList, for example in an Image template, something like: (:exif {$UpFile}:) or (:imageinfo {$UpFile} exif=0 iptc=1:).

Also note that there are other fine gallery scripts that can do titles, captions, individual comments, pagelists, categorisations, unlimited subdirectories and more, you can give them a try. You can also take the thumblist script and add some functions, and then you can support a "ThumbListPro" with all other features.

To resume: our script should be working, easy, simple and fast, but talk to me, because I am considering all propositions. If your nice idea can be done simply and easily, I will add it.

Thanks, and a Happy New Year! (Already said that, but) Wishing you for 2007 to take lots of nice pictures and to display them in many nice galleries! --Petko January 02, 2007, at 05:32 PM

Survey comments (optional)

There was a survey which features to remove. It is now closed, with Thumblist² staying small and allowing virtually any feature to be added as local customization. --Petko November 29, 2007, at 02:30 PM

I'm sorry you feel you need to remove features. As the instigator for several of these I feel that to meet the needs of a wide(ish) audience it is inevitable that there will be more features than any one person would want. Having said that I think there are a few areas where supporting a feature that is available elsewhere would work, eg

  • support random quote by supplying anchors between each image
  • support WikiTrails by generating (yes I know another parameter) a bulleted list, eg

* some-image.jpeg %item=comment%
The interest shown in your recipe is exactly because these features are available and as importantly they work. Having tried a number of the image recipes this is really the only one. I urge you not to prune too deep or hard, thanks. Fortunately you are keeping the full version, well done. I guess if you go the the effort of creating and maintaining two version the proof of the pudding will be in the download count. Simon

About my general feeling, and why, you can read the "Feature Selection" chapter of "Getting Real". --Petko January 19, 2007, at 04:28 PM

Comment

  • Very nice and clean recipe

Displaying the full image inside a wiki page

I like this very much. One request: It would be nice if there was an option for some back link to appear on the full image view. Or perhaps provide an option for the new page to use the current skin, or a custom header or footer with content supplied by a wiki page. You might take a look at Hagan's ThumbnailLinkToImage to see how he handled the issue.

Thank you! Well, it was meant to be simple, and as most browsers have a "Back" button (or the user can press Backspace), I wouldn't complicate things more. It is also much less load for the server this way. Note that the other galleries in Category.Images can do this, and even more, if it is required. --Petko December 12, 2006, at 02:49 PM
Done, will appear on the next release. You can see how it works at my sandbox. Thanks for this idea! --Petko December 13, 2006, at 09:41 PM

Gallery without thumbnails, real pictures resized down in the browser

Nice and easy to use. Thanks. I have tried several gallery recipes but none of them is as easy as this (I even didn't manage to get WikiGallery working at all)

I'd like to use my local PmWiki with my pictures. So there's no use to resize the pictures smaller. But somewhere there is a limitation because Thumblink don't work with big images. Could someone advice me in this. I use Puppy -linux and Xampp.

But thanks for this recipe: it's great !

Teukka

Even if I believe such option will be rarely used, this can be done easily and lightly so I added it to the code (yet to be released, hopefully before the end of the week). --Petko December 13, 2006, at 12:17 PM
Set $ThumbRedoThumbs=-1; to your config.php. --Petko January 09, 2007, at 05:06 PM

Width parameter, Image templates, Alt and external directories

Thanks, very nice recipe. However, there are few things I'd like to request/ask:

  • When creating one picture, the thumb is limited by height. However, ideally the width should be the first choice since a html page is limited in width and not in height (Usually).
    • Done, in version 2006-12-28. You can use width=100 now. --Petko December 28, 2006, at 06:59 AM
  • When showing the picture inside the wiki, the page is dynamic. Ie, a user cannot add comments on this page.
    • This was a wanted feature, the "light" and "simple" part, but in version 2006-12-28 there is a page variable {$UpFilePage} that may enable you to do comments or other stuff, see the section "Displaying the original pictures inside a wiki page". --Petko December 28, 2006, at 06:59 AM
  • The alt name is showing the full path. This changes the table structure if the picture is not shown. In my php file I changed the following:
    $output .= "$td1$a1<img border='0' src='$thumbname' alt='$thumbname' title=\"$title\" class='thumbs' width='$imgw' height='$imgh'/>$a2$td2";
    to
    $output .= "$td1$a1<img border='0' src='$thumbname' alt='$title' title=\"$title\" class='thumbs' width='$imgw' height='$imgh'/>$a2$td2";
    • Done, in version 2006-12-28. Thanks. --Petko December 28, 2006, at 06:59 AM
  • It would also be nice to be able to load the pictures in a folder as well as a group (the reason being that i can simply ftp my local folder to the server (within the group upload page) and simply point to it. But thanks anyway for the great work already done.

Reda

Those pictures cannot be displayed if $EnableDirectDownload is set to 0. The "picture folder" should be kept a PmWiki Uploads directory structure, but see also PmWiki.UploadsAdmin, especially the setting $UploadPrefixFmt = '/$Group/$Name'; which may be all you need. There are other scripts that can do what you wish, and more, check out Category.Images. --Petko December 28, 2006, at 06:59 AM
If you use $UploadPrefixFmt = '/$Group/$Name';, you must then name your upload directory /uploads/MyGroup/MyGalleryPage (case sensitive, the bold part same as the page where the command (:thumblist:) is) and all files should be inside. It depends on your wiki settings. If you change the $UploadPrefixFmt variable, chances are that files uploaded before the change may become invisible to PmWiki. So, maybe, move the files in the new directory. If you don't know what is the exact directory, upload a test file from the attach link on that page, PmWiki will create the directory and you can see it through ftp. --Petko December 28, 2006, at 08:48 AM

Image trails, custom page variables

How can I create an image trail in an Image Template?

Image trails are available in the version 2007-01-14. See example: Thumblist/TemplateTrails; docs updated. --Petko January 14, 2007, at 12:17 AM

Custom width page variable

Would it be possible to make image height and width available as $ page variables, eg $ThumbWidth and $ThumbHeight. The reason for this is that if I display the full image (ie click through from the thumb) with no template then Firefox nicely resizes the image down to exactly fit in the space available if the image is larger. Using the template the image is displayed full size and I get scroll bars. What I'd like to achieve in some manner is

%width=95pct max-width={$ThumbWidth}%Attach:{$UpDirUpFile}

These variables would have the same values as %w and %h = width and height in pixels of the actual displayed picture, not a fixed constant. How can I use the actual image width and height in the ImageTemplate?

Available in the version 2007-01-14. Use {$ThumbList_w} and {$ThumbList_h} for %w and %h, etc. --Petko January 14, 2007, at 12:17 AM

Lightbox integration

It is a very nice and handy recipe indeed. Sadly i have already built my image galleries with ImageSets.

One addition i implemented there was the use of Lightbox v2 ( http://www.huddletogether.com/projects/lightbox2/ ). All you have to do is include the .js files and add a "rel='lightbox[galleryname]'" to the hrefs. I was very pleased with the result. I'm sure it will also work for this recipe.

* Thanks for the lightbox link, looks quite nice!! Reda

Very small change to the recipe. Very big increase in usability (IMHO). And in browsers with JavaScript turned off it simply defaults to linking to the original picture.

Done (in theory, please test it), in version 2006-12-28. You should be able set in your config.php $ThumbLinkAdd="rel='lightbox[set%G]'";. --Petko December 28, 2006, at 06:59 AM
  • * Thanks for the quick fix. The extra tag is added but the link does not work. Am I doing anything wrong? Could it be because the href is not pointing to the picture? Thanks. Reda
Probably, I don't know Lightbox. Try without usetemplate=1. If you have set $ThumbListUseTmpl=1;, try with usetemplate=0 --Petko December 28, 2006, at 08:48 AM
  • Thanks. I'll give it a go later on. Thanks
I've set a page at my site to demonstrate that the Lightbox javascript is working. I just had to adapt the image urls in the .CSS file and in the beginning of lightbox.js -- you can see/take them here. --Petko December 28, 2006, at 11:21 AM

Bug fixes

On my skin, (Triad), when I use the template, the link back to the gallery doesn't work, but it works fine on PmWiki skin. The problem is that Triad disables self-referencing links. I'll have to look where that is and disable it. For now, my workaround is to simply add an action to the self-referencing link, that is:
[[{$FullName}?action=browse|$[Back to Gallery]]]

Pico

Thanks for the "autolink", I'll change it in the documentation and in the code (if a template is not found, there is a link back). --Petko December 30, 2006, at 12:17 PM

Lightbox - better integration

Ok, now in setting up Lightbox, for the lines that you add to your config.php (or Group.Page.php file), I had to change the references from "/pub/lb/..." to "$FarmPubDirUrl/lb" to get them recognized on my farm configuration. (You could use $PubDirUrl, but $FarmPubDirUrl defaults to $PubDirUrl).

Even on a simple non-farm configuration, hardcoding the reference to "/pub/lb" seems like it wouldn't work for anyone that installs PmWiki in a subdirectory (/pmwiki/pub/lb), at least not with clean urls (I say that because when I tried moving the code and files from my farm to my field, the hardcoded reference did not find the files).

Pico December 30, 2006, at 02:24 PM

It is possible to define a JavaScript variable that will contain the $FarmPubDirUrl. The latest howto and modified files are available here and should be OK in almost all configurations. Thanks for your observations and remarks. --Petko December 30, 2006, at 03:24 PM''

Individual image captions and external page comment variables

nice script. It would be nice to be able to add a caption to each image (like the optional attribute that can be added in the config file).

  • Also, it would be nice to be able to refer to a variable on a different page, like the number of comments for a specific thumb (e.g. {Pics.picturenamejpg-comments$FoxPostCount}. Thanks
Tried to reply at Creeping featurism. I am considering the idea of individual captions though, how do you think it can be implemented (without external page reads)? (I mean wiki markup.) --Petko January 02, 2007, at 05:32 PM
Individual captions are now available with the (:thumbgallery:) markup. --Petko January 22, 2007, at 10:40 AM

Extracting IPTC/EXIF metadata

Very nice recipe, I know You want to keep it simple and easy but I have to ask, is there any way to get it reading IPTC -captions? Not to edit them just to show somehow. Thanks for this!

PeeJii

Probably not from this recipe, but someone can write another one. See Creeping featurism. I tried to extract IPTC headers, but was unable to do this from PHP (even if the images contained such data). What is more likely to work, would be reading EXIF data, but, again, from another recipe. --Petko January 02, 2007, at 05:32 PM

It's probably not as hard as you think to extract metadata, nor as "expensive". Think about it, you are already opening all of the image files to get the dimensions, so reading EXIF data won't take much extra time.

I suggest you forget comprehensive extraction and stick with common (and easy) image parameters such as date/time, exposure, aperture, ISO value, and -- the one your script needs most by far -- comment (or "JPEG comment", which I think is a special case). See qdig-metadata.php for my perhaps crude metadata-extraction code from qdig-devel. Allowing people to embed comments/captions in the images with something like IrfanView would really round out the feature set.

It's surprising how much of a jumbled mess EXIF support in PHP turns out to be. I spent a long time just getting as far as I got, but having my code to start with might speed things up for you. I also have a bunch of images from various cameras to use for testing, if you would like those.

Testing for EXIF support is very easy, btw. Just do something like

if (!function_exists('exif_read_data')) { $exif['ena'] = FALSE; }

All that said, I took the same "EXIF is creeping featuritis" position for years, so I can understand why you'd give up on adding it, at least for now.

Btw, I gave your script a quick test and it's very impressive. I'm particularly impressed with how quickly you've blasted through a lot of problems that I experienced during the development of Qdig. Nice work Petko!

Oh... another suggestion I was going make was to add a gd-detection function. There's one in Qdig and also a generic example I posted as a comment in the PHP manual. I imagine by now GD 2.x is extremely common, but someone trying to run your script on a machine with 1.x will get a rude surprise in the form of a fatal error. It shouldn't be necessary. The PHP developers should have handled that differently, IMHO.

--Hagan

Thank you Hagan for your comments and for your code. I was testing the exif_read_data function like from the PHP manual, but I'll probably use some lines of your qdig-metadata.php. I still believe that metadata extraction is times slower and more "expensive" than just "getimagesize()", so if we implement it for the thumbnail galleries, it will be optional, probably in an external script. About the image captions or comments, I feel that it is much easier and more usable to have and edit these texts in the wiki rather than inside the picture itself, or in an uploaded file -- because you can change your mind, and because you may put another caption to the same picture from a different page/context. So, I was thinking that more appropriate for small captions or descriptions may be not an automatic, extracted data like for the title tooltip now, but something like the MediaWiki markup, like:
(:thumbgallery [options]:)
picOOOO1.jpg | caption or description
picOOO55.jpg | caption or description
(:thumbgalleryend:)
If people think this is worthy, I'll see how it can be added. --Petko January 03, 2007, at 01:43 PM

It will be easy to test how much the EXIF function slows page rendering by using a skin that prints out $StopWatch at the bottom and enable/disable the feature. I predict the slowdown will be measurable, but not noticeable on a reasonably powerful server, that being a server powerful enough to resample thumbnails without too much trouble.

Your imagename | caption idea is a good one. Syntax for image alt-text, titles, and captions has been agreed upon via discussion on the pmwiki-users list, so I recommend keeping it consistent with that. See PITS:00657 .

--Hagan

Thanks, on my to-do list. --Petko January 04, 2007, at 06:59 AM
Basic EXIF extraction is now available with the exif=1 parameter as percent variables. See also titlefmt= and captionfmt=. Individual captions/comments, however, may be easier to add/edit with the (:thumbgallery:) markup. --Petko January 22, 2007, at 10:40 AM

Random Thumbnail

This is definitely a creaping feature, but how about ...
(:thumb random:) or (:thumblist start=random:) (where limit would wrap round to the start).

Simon
Try shuffle=1 at Thumblist/Shuffle. May appear in next release. --Petko January 18, 2007, at 06:34 PM
Parameter shuffle=1 is available from version 2007-01-20. --Petko January 22, 2007, at 10:40 AM

Variable to test

If the thumblist does not return anything because there are no pictures, is there anything I can test for true or false to hide/show also some related text? Thanks.

Yes, this may be improved. These are the cases ThumbList returns nothing: (1) no read permissions on the other page where the pictures are uploaded, (2) a thumblist command and no picture files or files invisible to PmWiki, or name and skip patterns defined and no matching filenames, (3) start= defined more than the number of matching files, (4) a thumb command and no file specified, (5) a thumb command and file not found. I'll add this, but displaying a message will be optional (from variable in config.php). Thanks. --Petko January 04, 2007, at 06:59 AM
Available from version 2007-01-10 --Petko January 14, 2007, at 12:17 AM

New development version

Download - see and test.
I am working on the script and did a lot of changes. It seems to work but still haven't documented it. (:thumbgallery(end):), single image captions, warning messages, GD0-1-2 test (very simple), EXIF (very basic). I am considering though splitting the project in two, a thumblist-light version (simpler as originally intended) and this one. --Petko January 04, 2007, at 09:46 PM

Just installed this - deleted all the thumbs and it created them all in one go!. Works wonderfully well, my compliments on your hard work and great product, I recommend it to anyone. - Simon


New version ready to be tested

Hi, I rewrote the documentation page to give the basic usage first, and the advanced usage below, so that new users will hopefully not be scared by the added complexity. The new script version from today fixes some bugs and adds some new advanced features (read the Release Notes). Please test it. Your comments are welcome. --Petko January 09, 2007, at 04:59 PM

Example thumblist

Captions and Order

To avoid entering each image name, and assuming pictures are ordered consistently in some manner (eg alphabetically ascending by name, or by EXIF date (now there's a thought, how about an order parameter)), could the picture name be optional, and captions assigned to pictures in the order they are loaded, eg
(:thumbgallery:)
| Caption | Tooltip title
| | Another tooltip title
|
| Another caption | previous picture had no caption
(:thumbgalleryend:)

  1. I also wanted to have an attribute "order=" but this would require the script to open, read and store in RAM all metadata from all files in the upload directory, then to sort them. This will be very slow. Now the files are just checked if they are pictures, and only the selected (if you have start=, limit=, or name=) are really opened for the metadata, that is faster. I wouldn't change the algorythm at this point.
  2. If you upload another file, the order may change, that's why it is better to write the file name and caption on the same line.
  3. The (:thumbgallery:) markup allows you to select only the pictures you wish and to order them the way you wish: pic3.jpg, then pic1.jpg
  4. The (:thumblist:) markup performs a natural number sorting, so you may batch-rename your files to the order you wish (try with IrfanView).

That's why, currently, the script is as it is. Thanks. --Petko January 09, 2007, at 05:27 PM

that is very helpful, thanks. Would it be possible then to have a thumgallery parameter that showed all thumbnails, whether or not they had a caption specified?

Available from version 2007-01-14, "ThumbList mode". Use (:thumbgallery tlmode=1:).

Just to drop a note

Just to drop a note to say thanks Petko. This is what I manage to cook up with the basic version of thumbnail. --hua January 13th, 2007

Thanks! --Petko January 14, 2007, at 12:17 AM

I'll second those thanks in spades, great recipe Simon


Bug report and CSS suggestion

Excellent script! And please keep it simple and clean. I hate recipe scritps that do everything for everybody. Do one thing and do that well.

Unfortunately I have a bug to report:

  • When Supercache=1 the trails {$Prev/NextLink} are not showing when the photo is displayd in the ImageTemplate. Turning Supercahce off restores everything back to "normal."

The css you give for the .thumptable is useless as long as you set the styles in the thumblist.php script. The inline styles from the script override the styles set in the css.

I have commented out theline

  $h = (@$Width)? '' : " height='$Px4'"; 

and changed the line:

  $td1 = "<td class='thumbtd' align='center' valign='top'$h 
    width='$Px4'><div class='img' style='padding:$pad $pad'>"; 

to

  $td1 = "<td class='thumbtd' ><div class='img' >";

I use these two line css to get a marvelous gallery page

  .thumbtable	{	margin-top:20px; margin-bottom:40px; }
  .thumbtd	{	padding-bottom:40px; padding-right:25px; } 

Keep up the good works, Han, jan 19, 2007

Thanks for the bug report, fixed in version 2007-01-20 (just released).
Inline styles are used in order to center the thumbnail in the table cell. If you try to list small pictures, i.e. icons or other, smaller than the requested thumbnail, you will see the difference. Do you have a public website so that I can see your marvelously styled gallery? --Petko January 19, 2007, at 05:29 PM
Thanks for the quick fix. Site: http://palimpsest.xs4all.nl Han jan 22, 2007 at 10.06 AM CET

ThumbList warning: Only 0 files found but you set start=1.

I'm sorry but I have run out of ideas to get this to work. I have tried everything on this page and the documentation page so far but I still only get this error:
ThumbList warning: Only 0 files found but you set start=1.
I can see the files after I upload them through the upload page but I never get any thumbnails. I have a dozen other recipes running on this site and I have "corrected two of them myself even though i am not a css author or PHP writer so I do know all the basics.

Any help is appreciated.

Thanks,

BillReveile January 30, 2007, at 12:32 AM

I am assuming that you have the latest version of ThumbList that is "2007-01-20". There are two possible problems here:

  1. the PHP function getimagesize() is disabled or returns nothing, so the script thinks the files it found are not pictures and skips them;
  2. you set a $ThumbMaxArea variable and all files are bigger in megapixels.

Or maybe something else. I could try the script at your site sandbox, test some options and uploads, or send you a debugging version -- if you wish, please contact me at 5ko (snail) free.fr. --Petko January 30, 2007, at 06:55 AM


Compliance with regular attachment behavior

Since the recipe deals with image uploaded as page attachments, this could be nice to have the markup acting as the attachement prefix, ie when I specify (:thumb not_already_uploaded_image.jpg:), I would love to have the markup rendered as an upload link (as Attach:not_already_uploaded_image.jpg would have done), instead of an error message. Same consideration applies to other markup forms.

I don't want to sell my soup here, but you may have a look at LinkedResourceExtras ;).

Dfaure February 01, 2007, at 11:34 AM

Added in version 2007-02-01a (for the (:thumb:) and (:thumbgallery:) markups). The reason why it is this way, is that it began as an (:attachlist:) enhancement so it would normally display notning; the (:thumb:) markup came later and inherited this behaviour. About your soup, mine was cooked first, so, c'est la vie, chef. :-) --Petko February 01, 2007, at 12:22 PM

Image trail

There is an issue with your gallery: you cannot have filenames with spaces and hope to display them via an Attach: link in your template. This is a PmWiki limitation of the Attach: markup. You should rename the files that contain spaces. --Petko February 26, 2007, at 03:52 PM

Actually a very handy hint from Uploads gets around this, viz

[[#blank | Attach:image name with spaces.jpeg"Sea lion"]]
Sea lion

I tried to use [[{*$NextLink} | Attach:{*$UpDirUpFile}"{*$UpFile}"]] in my image template to cater for the possibility of spaces in photo file names, but the $NextLink variable doesn't work the way you might expect.

The $NextLink allready contains the closing brackets. I made a new version with variables $NextLinkUrl and $PrevLinkUrl that may be used inside brackets like this: [[{*$NextLinkUrl} | Attach:{*$UpDirUpFile}"{*$UpFile}"]]. Feel free to test it. Note that these are not full URLs, no http://, just the PageName?action=imgtpl... and may change in the future, if I find a better name. --Petko February 27, 2007, at 01:50 PM

Thanks, these new variables appear to work $NextLink and $PrevLink seem not to be working, see

[1].
Also where there is no $NextLinkUrl would it be possible to have the trail loop back to the beginning, because when $NextLinkUrl is null [[ | Attach:{*$UpDirUpFile}]] does not display anything.
New version 2007-02-28. I believe the first problem was fixed. In this version, if there is no previous/next picture, the *LinkUrl points back to the gallery (the *Link is empty like before). See example (template) - click on the picture to open the next one. --Petko February 28, 2007, at 05:20 AM
Note that this is experimental feature and code, I don't like much how it is handled now and it may change/dissapear. --Petko

That's great, a good solution, happy if it continues to evolve. --Simon


Minor issues with version 2007-02-26

This is a great recipe, thank you! I had some issues.

  • When (:thumbgallery Group.Page name="photo?.jpg" cols=3:) was used, and photo1.jpg... photo6.jpg were already in the uploads directoty, the gallery just didn't get displayed, unless (:thumbgallery...:) was preceded by a plain (:thumblist:) but even then, sometimes it didn't work.
  • When I switched to per-page uploads I could use a simpler (:thumbgallery name="photo?.jpg" cols=3:) and then the gallery did get displayed. I could even use tlmode=1 with no problems.
  • With per-page uploads thumbgallery warns about not being able to open the group default page's upload dir, uploads/Group.Group. This is unnecessary.
  • In the script file does line 39 SDVA($HandleAuth, array('purgethumbs' => 'edit')); provides a hook for local config to change authorization level to something other than edit? I need that.
  • Line 369 $MessagesFmt[] = "Caching gallery$t $n for $currentpage<br />\n"; has $t which is not initialized anywhere


SteP

Thanks for your feedback. (1,2) the "name=" is not used for thumbgallery unless you have tlmode=1. With thumbgallery you need to list each file on a line, or use tlmode=1 and it behaves like a thumblist. If not, there may be a bug, please show me a page or set one on Thumblist/Sandbox. (3) To never display warnings, you can set in config.php $ThumbShowErrors=0;. (4) Yes, you should be able to set in config.php $HandleAuth['purgethumbs'] = 'admin'; or 'read' or another auth-level. (5) Thanks, will be fixed (at one time it was, then the code changed, forgot this). --Petko March 14, 2007, at 04:12 AM
(4)In my config.php I set
     $DefaultPasswords['zap'] = '@zapentry';
     $HandleAuth['purgethumbs'] = 'zap';
then I login as a member of @zapentry, go the my custom upload page (I changed Site.UploadQuickReference and click on a link to {*$FullName}?action=purgethumbs, the login form is shown (shouldn't be) and any attempts to login as a member of @zapentry bring back the same login form. I can break the loop by logging in as admin, which purges the thumbnails. ThumbList doesn't seem to honor the HandleAuth in this case...
Thank you: there was an omission, now hopefully fixed. Can you please test the new version and confirm that it works? If it's the case, I'll release it. --Petko March 14, 2007, at 05:06 PM
Yes, it's fixed, thank you. However, I noticed that this version has other changes that apparently affect the size of my fonts in some pages. I noticed that pages that load thumblist and thumgallery now show bigger fonts in Site/PageFootMenu and in some input form button labels. I used fixflow skin if that matters.
Back to (1) above, I think the issue is when Group.Name is specified as a PTV
    :TheGroup:SomeGroup
    :ThePage:SomePage
    :Gallery:{$:TheGroup}.{$:ThePage}
    (:thumbgallery {$:Gallery} ...:)
OK, I believe this one is fixed too (please test the version 2007-03-15). FWIW, it worked if you have :Gallery:SomeGroup.SomePage but not if you have a PageTextVar definition made of other PTVs (now corrected). You are building quite complex applications if you need to control the ThumbList displays with PageTextVariables made of other PageTextVariables... good luck! (About the font styles, nothing has changed in that direction since version 2007-02-02 of the script, maybe you updated a skin, a style, or a browser, or set a browser minimum font size.) --Petko March 14, 2007, at 07:07 PM
Great, it's fixed. Thank you very much! -- SteP March 15, 2007, at 11:50 AM

Thumbgallery and Attach

This is a bit of a problem. Normally thumbgallery shows upload links for pictures in its list that have not yet been uploaded. However, when the upload scheme is Group.Name and there are no uploaded pictures (or uploads/Group.Name doesn't exists), thumbgallery shows no upload links at all. This is inconvenient, as one is forced to add Attach links to the page, and as soon as the first picture is uploaded, the names of the missing pictures show up twice, once in thumblist and once in the added Attach link. SteP March 18, 2007, at 09:29 AM

Done as of version 2007-03-18 (now thumbgallery will show upload links even if the directory does not exist). Thanks! --Petko March 18, 2007, at 10:13 AM
Confirmed, thank you! SteP

Printing from template

Is it possible to define a template that includes a link to print the current image with the print skin? SteP April 30, 2007, at 01:17 PM

Unfortunately no, because the print skin is called by the URL-parameter action=print, and the image-inside-template by action=imgtpl, there may be only one action= at a time. --Petko April 30, 2007, at 01:42 PM

Multiple Image Upload

On my site, I have about 40 pictures to upload to my gallery. Is there a way I can upload multiple files at once? I wish you could just select multiple files on the attach page. Would that be possible? Thanks a bunch! --diafygi May 2, 2007, at 05:00 PM

Not with this recipe, and currently, there is no other recipe that can do this. If you have an FTP access, you can copy the files with FTP. To make sure you copy the files in the correct directories, first upload one file to each directory through the attach link, and PmWiki will create the directories. --Petko May 02, 2007, at 05:33 PM

Multiple ThumbGalleries

I am using two thumbgallery instances on a page, each using the 'usetemplate' tag. When I click on the images in the second gallery, the 'nextlink' links don't work correctly.[2]

I've set a test page at [3] and [4] and it works. I suggest you upgrade the recipe to the current version (you have 2007-02-26, current is 2007-05-01), and delete from the upload directory the cache files .thumblist*.cache where there is a problem. --Petko
I have to say, I like very much your meccano-encyclopedia and the way you're using the thumblist recipe, very nice pages! :-) --Petko May 05, 2007, at 07:48 PM

That worked, thanks very much for such a useful recipe. Thanks for the compliment, I rely heavily on your recipe, so the site owes a lot to you. - P.B

Supercache and conditionals

Using Cookbook.MultiLanguage the following source

(:cell:)
(:if userlang de:)
(:thumbgallery cols=2 align=center usetemplate=1 supercache=1:)
p1.jpg | de
p2.jpg | de
(:thumbgalleryend:)
(:if userlang en:)
(:thumbgallery cols=2 align=center usetemplate=1 supercache=1:)
p1.jpg | en
p2.jpg | en
(:thumbgalleryend:)
(:fi:)
doesn't switch the caption when the language is switched. Remove supercache=1 and now the caption language switches properly. My guess is that captions are supercached.
SteP April 30, 2007, at 04:16 PM

You need to indicate different "supercache-IDs" for each gallery, and to do this, set manually a different number>1000:

  • (:thumbgallery supercache=1001:) for the german one
  • (:thumbgallery supercache=1002:) for the english one

Added as of version 2007-05-01. --Petko April 30, 2007, at 06:31 PM


Valid CSS

I just wanted to let ya'll know that text-align:middle; is not valid CSS. This change needs to be made:

from:
  table.thumbtable td.thumbtd div.img { border: 1px solid #dddddd; text-align:middle;}

to:
  table.thumbtable td.thumbtd div.img { border: 1px solid #dddddd; text-align:center;}

I don't really feel qualified to change the front page, so I just wanted to let everyone know.
-Diafygi 2007/07/12

Thanks, now changed. --Petko July 12, 2007, at 04:15 PM

Improper Display on IE7

For those of us not using *real* operating environments :-), a user reports a problem with IE7 not displaying all the thumbnails if the thumbs are particularly large. The same user reports flawless operation under Firefox 2.

If I set (:thumblist px=240 target=_blank:) in a group with a bunch of 2800x1600 or so images in it, Firefox shows all the thumbs in a scrolled window. IE7, however, seems to only display the 4 or so thumbs that appear in the first page, omitting the scrollbar on the side, such that you only see 4 images. Odd, IE6 works great just like FF2 for this.

Is there some javascript or something that is occurring that might be causing IE7 to choke? Can anyone else independently verify?

Thanks --RussFink

There is a problem with the following code from your local.css:
 body, html, #wikibody, #wikimid, #wikitext { height:100%; }
 object { overflow:hidden; }
Try to use min-height:100%; overflow:auto; instead of height:100%; (or remove the first line), and/or overflow:auto; (or remove the second line). This is unrelated to thumblist, different interpretation by IE7, of the CSS that you added. --Petko October 24, 2007, at 06:29 PM

Thank you very much! I had added local.css months ago to combat a problem with my earlier attempts at a gallery, which was to include a Picasa-generated page. Someone on the Pmwiki users list gave me some CSS to run. Disabling the local.css to get Thumbnails to work conflicts with the changes to get Picasa's page to load sensibly, but since Thumblist works much better anyway, I'm throwing out Picasa. Take care, RussFink


Geotagging

(Reda - 05/07/2007). Geotagging would be a nice feature to have. I.e. It would be nice to see a small image thumb when clicking on a marker on googlemaps. Clicking on the image would show the full picture. Possibly it can be achieved by using the thumblist and GoogleMapAPI cookbooks. Thumblist could be expanded to generate a text file (in same folder) with image location, thumb location, lat and long (from Exif info) for each picture in a folder... The GoogleMapAPI cookbook then would only need to read the text file and generate a gma-point for each line with lat-long and image thumb location... I'm asking a lot, I know... but seems nice. Any comments? Can it be done?

Not easy, and for some months (until Jenuary 2007 likely later) I will be unable to code this. --Petko July 12, 2007, at 04:15 PM

Captions

The new caption feature is great[5]. Two suggestions please

  • a page variable usable on the image template page that supplies the caption for the image if it was defined on the gallery page
  • allow markup in captions, eg bold, italics, links, wiki styles
I don't really know how to do this without complexifying and slowing a lot the script (I tried). What I will do really soon is a demonstration for a commenting feature with PmForm and an included {*$FullName}-{*$UpFilePage} page where you can put the description, links, bold texts, and comments. It will allow you to do better, more things than extracting a line from the gallery page. --Petko November 20, 2007, at 03:40 PM

Ampersand in file names

  • I have noticed a little issue[6] where the thumbgallery picks up the file descriptor from the directory OK, but doesn't seem to recognise or match the same file name in the caption list - there is an ampersand in the file name.
PmWiki itself seems not recognize the file name as a valid upload. If you try to upload such a file in PmWiki, it will remove the ampersand. If you copy the file with FTP, the Attach: link will not work. Test. I have no intention to support this, because the ampersand is a special symbol both in URLs and in shell command line (listing and ImageMagick). Sorry.
I am considering all such cases as bugs, if the files were uploaded by the PmWiki interface, and are visible to PmWiki both in an (:attachlist:) and in Attach:File.jpg links. Thanks. --Petko November 20, 2007, at 08:10 PM

Specify Alternate Link

Is there a way to specify an alternate link for each image (Ex: linkfmt=SomeGroup.SomeName)? This would be particularly useful when sampling images on a different page, allowing users to jump to the source page rather than the image.

Use link=-1 and add a text link below. In detail... --Petko March 28, 2007, at 03:21
From version 2007-09-17 you can also use link=2, then clicking on a thumbnail will point to the (different) page where the gallery is uploaded. For example, (:thumblist Photos.Paris limit=3 link=2:)= will display the first three thumbnails from the page Photos.Paris, and each thumb will link to that page Photos.Paris. Demo. --Petko September 16, 2007, at 09:09 PM
In Thumblist² (from 2007-11-28) you can also use link=Group.Page. --Petko November 28, 2007, at 01:01 PM

Multiple source pages, wildcards

Can I say (:thumblist TTC.Activities TTC.Activities-Gallery :) or (:thumblist TTC.Activities* :). Thanks very much

Simon (using latest version)
Not at the moment. But you can do (:thumblist TTC.Activities:)(:thumblist TTC.Activities-Gallery:) or for more complicated stuff, insert the thumblist inside a PageList template. --Petko September 03, 2007, at 01:42 PM
See also MultiThumblist. --Petko November 28, 2007, at 01:01 PM

Sort by upload date

I don't know if Thumblist already does this. But I would gladly add this feature to the latest version by request. Else check out thumblist_sort.php. --Aidin Abedi

Thanks. I plan to add ordering of the thumbnails by name, ctime, mtime, size (all ascending or descending), no sort at all (directory default) or random, and possibly on other/EXIF variables. But because getting most of these bits of data require at least a stat or even opening and reading every file in the upload directory, such a feature will slow down a lot any website, so the sorting will be optional (using a supercache will be recommended). --Petko November 04, 2007, at 12:00 PM
Or maybe we'll figure out a plug-in/recipe capability for ThumbList, so as people will be able to add their own features and functions while the ThumbList core stays small, slim and fast. I just need some time to think of the implementation. --Petko November 04, 2007, at 12:00 PM
By file extension would be useful too. SteP November 07, 2007, at 01:32 AM
These and a number of other sort orders were added at the new Thumblist². Demo. --Petko November 28, 2007, at 01:01 PM

Lightbox in v.2

Hi Petko

I'm new to pmwiki and Thumblist, but I am liking the recipe a lot. I was trying to use lightbox but it doesn't seem to work. I followed the directions on the pages but no luck. I'm not using template trails or anything so I'm not sure what it could be. Not much info here for troubleshooting I'm afraid.

bilu

Is there a webpage where I could take a look and eventually test it? Like a Wiki sandbox. --Petko December 11, 2007, at 06:03 PM

I have the gallery at http://vnblukas.net/index.php/Main/NewHouse. Hope that's enough information to work with. There is improvement since my last message as the images superimpose, but the next and back arrows don't appear. I appreciate your response. -bilu @ 10:45 PM on December 12, 2007. THX

Please use rel=lightbox[?G] for the arrows to work. This is a Lightbox "feature": when you use just rel=lightbox, it works for single images, and if you use an array it will display the arrows (with [?G] you point to all pictures in this thumblist). --Petko December 13, 2007, at 01:43 AM

THANKS! I misunderstood where I was supposed to put rel=lightbox[?G]. I originally put it in config.php. Works great now. -bilu @ 7:26 AM on December 13, 2007.

I added today one line to the user function, so that slideshows be enabled even with rel=lightbox only. It's simpler and easier to write. Thanks. --Petko January 04, 2008, at 08:30 AM

Thumblist on OSX 10.5 Leopard

Petko, Since I installed Apple's OSX 10.5 Leopard, the php is installed (by default) without the GD libs. I try to use your exellent recipe with Imagemagic. That doesn't work.

  1. I get the message :GD lib not found.
  2. Commenting our the relevant lines in the script at least makes the script go further, bur resizing is NOT done.
  3. I know imageMagic is working on my server as it works with Quadig.

So something else is (not?) happening. Han, december 12 2007, 19.24 CET

You need to set in your config.php, before including the Thumblist recipe, such a line:
$ThumbList['ImageMagickExe'] = '/usr/bin/convert';
If you don't know where is your convert executable, write in a console:
type convert
and it will show you. Then you enter it instead of '/usr/bin/convert' above. The other way is to install the php5-gd2.so library from your manager.
Note that you should not need to comment lines in the script: if there is a problem, I need to fix it, for all users. :-) In your case, if ImageMagick's path is correctly written, it should work without commenting out lines. --Petko December 12, 2007, at 05:15 PM

InlineCaptionCSS

Is $ThumbList['InlineCaptionCSS'] = 1; supported in ThumbList2?

No, it was dropped because the new "snippet" template system is much more flexible. Please see an example at FineTuningHTML: you can have the previous behavior and much more.

Linking the image back to the page

Hi Petko,

I am using Thumblist2 (latest version) with PmWiki. It is an excellent recipe and immensely useful. Thank you! Would it be possible to have the image link back to the page? In other words, once the image has loaded, can clicking on it again take me back to the original page? Is that possible? Is this outside the scope of your recipe?

Another question: I am continously running into people uploading large images that load with vertical and horizontal scroll bars. Is there a way that through this recipe, the original image is loaded relative to the screen resolution??

Again, I truly appreciate your recipe and all the help! skumar? January 02, 2008, at 02:48 PM

Hi, thanks for the kind words! (1) Read about the special ImageTemplate pages. Yes, you can have the big picture link back to the gallery by using something like [[{*$FullName}| Attach:{*$UpDirUpFile} ]] in your ImageTemplate page, or just have a text link below the picture [[{*$FullName}| Back to gallery ]]. (2) It is not possible for the script to know what is your visitor's screen size. But you can select a fixed size and again, in the ImageTemplate, instead of an Attach: link to the file, use (:thumb "{*$UpDirUpFile}" width=800:) for a 800px wide copy. If the file is larger than 800px, it will be scaled down, linking to the original; to link back to the gallery you'll need to use a text link. There are some examples here: [7] [8] and around. --Petko January 02, 2008, at 03:52 PM

Case-sensitive Extensions Problem

Hello - I'm having a problem on my site with images that end in upper-case ".JPG" .

I'm using the thumbgallery tag to match name="*.JPG". It finds the files just fine. However, when I click on any of the thumbs of those files ending in .JPG, instead of showing the full file, it presents me with a link to let me upload the image.

I tried another test pointing to files that had lowercase ".jpg" mixed in with upper case ".JPG". While the uppercase versions give me a link instead of an image, the lowercase images take me to the full sized image as expected.

Can you look at it when you get a chance? Here is my test page. The first and last image are .jpg and "work," the middle two are ".JPG" and don't work:

http://www.finalscoretrivia.com/Main/Sandbox

Here is my code for the thumb gallery:

(:thumbgallery 
  MDPhotos.MDPhotos 
  name="TB16_*0441.JPG|*DeltaForce28*|*princ*" 
  width=375 usetemplate=1 supercache=1 cols=2 tlmode=1:)

AppCol_DeltaForce28.jpg| test1 |
TB16_c1.JPG |  | 
beerprincess.jpg |  | 

(:thumbgalleryend:)

Thanks! --RussFink

  • Rename the files to lowercase extensions, or just upload them through the PmWiki upload form. This is a PmWiki standard behavior: the "Attach:" link in the ImageTemplate (or in any wiki page) does not work with uppercase extensions. PmWiki always expects files to have lowercase extensions, and when you upload such a file, PmWiki renames it, and when you link to it, PmWiki searches for the lowercase one. See also PITS.00315. Thumblist does not modify this PmWiki Attach: function, even if it will try to process uppercase files too. Note that filenames with spaces will not work too.
  • You can also use in the ImageTemplate the code (:thumb "{*$UpDirUpFile}" width=800:) instead of Attach:{*$UpDirUpFile}. But renaming the files to what PmWiki expects is recommended: Thumblist should only be expected to work when the files are visible to PmWiki through both the (:attachlist:) and Attach: links. --Petko December 10, 2007, at 12:52 AM

Thumbnails from pages in a category

Hi Petko

Is there a way, how i can make the thumbnail link to the page where it is atattched, and not the whole group? I know its possible for one image alone by specifying the link, but how can it be done when there are more pages in a category and each thumbnail should link to the page of the category its attached and not the whole group?

and is it possible to only show the thumbnails of pages that are specified to a category, when there are more categories in a group?

thx

I'm not sure I understand everything. Something similar is possible (only) if you have "per-page upload directories", see $UploadPrefixFmt, UploadsAdmin and UploadGroups. You can use page lists like (:pagelist link=Category.Christmass2007 fmt=#thumbnails:) and in the Site.LocalTemplates you define the #thumbnails template like: (:thumblist {=$FullName} link=2:) or link={=$FullName}. It is an advanced configuration, you need to know or to learn about PageLists and PageListTemplates manipulations. They are out of the scope of this manual and help page. --Petko December 26, 2007, at 03:22 PM

Supercache is broken in version 2008-02-08

It seems that the usage of the Keep() function is messing up the supercache function of ThumbList2. Obviously Keep() replaces the markup that is to be kept with some cryptic number code and reinserts it at the end. Too bad that this cryptic number code gets cached within the supercache. Then upon reloading the cached thumb list, the PmWiki engine doesn't know anymore what the code meant in the first place. How could it, anyway?

The solution obviously is to uncommented the commented out line in the ThumbReturn() function and to ban all usage of Keep() from the FmtThumbList() function. Here is the patch: supercache-fix.patch.txtΔ

This bug was exceptionally hard to find since the supercached page worked when the cache was being created in the first place but not when it was being loaded from the cache. Also I didn't know the Keep() function which is only implicitly documented on dubious pages and not explicitly on the functions page. See CustomMarkup under "Define a custom markup to produce a specific HTML or Javascript sequence" or search for "keep(". --Fritz Webering March 09, 2008, at 06:04 PM

Thanks for finding this bug. I fixed it differently, as the Keep()s are needed when there is markup in captions. Before the cache is stored, it is now converted to HTML including all "cryptic" (actually escaped) entries. Thanks again. --Petko March 10, 2008, at 04:16 PM

Well, that's a point. I already thought you must have had your reasons to do it that way, because of the commented out line in ThumbReturn(). But the way you do it now causes problems when the content of the supercache is loaded and output to the page as raw HTML. The PmWiki engine will screw up all of the links. But that's easy to fix: just do ThumbReturn(Keep($output)) on line 137. --Fritz Webering March 13, 2008, at 05:33 AM

I believe it is now fixed with version 83D (using MarkupRestore instead of MarkupToHTML). Please test the new version and confirm if supercache is working as you expect. Thanks. --Petko March 13, 2008, at 10:19 AM

No, it's still not working. For a moment I thought that the problem might be due to the fact that I override the '_tmpl' settings to make the pictures display as floating <div>s. But it's just the same when I comment out the according lines in the config.php. The problem seems to be that the supercache files contain raw HTML, such as <a href="http://tbwiki/uploads/Jahr2006/Fotos/IMG_2416.JPG" class="highslide" onclick="return hs.expand(this)" >. This causes the PmWiki engine to interpret the "http://" part as a link, just as it does here, and replace it with another <a></a> tag. The only way I see to get rid of this is to pipe the contents of the supercache through Keep() before passing it to PmWiki. This only applies when the gallery has been retrieved from the cache though. Not when the page is first being generated. Since I don't really need markup in the image captions I'll just stick with this solution. -- Fritz Webering March 22, 2008, at 10:03 AM

Thanks for this report: at all my installations this problem didn't appear, and the reason was that I had manually defined three variables as I've had problems with their automatic detection by PmWiki:

 $UploadUrlFmt = "/uploads";
 $FarmPubDirUrl = $PubDirUrl = "/pub";

However, Thumblist2 should work with a default PmWiki installation, so I'll look closer to fix this problem. It appears that the newest requested feature with markup in captions has caused much more problems than it solved... Thanks, --Petko March 22, 2008, at 11:18 AM

Please test the new version 83M (just released). It should finally work. Thanks for your help improving the recipe. --Petko March 22, 2008, at 03:43 PM

Hey, that seems to work. Maybe the solution is not too efficient, but it looks like it does its job as long people don't use fancy JavaScript in their templates. The JavaScript code would be stripped of its opening and closing tags and be processed as markup, as would any type of plain text that's included in HTML tags. At least from what I see on the first glance. But so far that's only hypothetical I think. -- Fritz Webering March 25, 2008, at 01:50 PM

The version 83P is quite efficient. Could you possibly tell me what fancy JavaScript and HTML are you using in your snippets: it should be possible to manage it. Also note that usually you would want to enclose JavaScript in comments to hide the code from older browsers:
<script><!--
some_code(); //--></script>
and this one should be properly escaped too with 83M-83P. If you feel that this is out of the scope of this manual here, please e-mail me directly. --Petko March 25, 2008, at 02:16 PM


Single random thumb

Any reason why we can't have a randon single thumb, viz

(:thumb TTC/WellingtonsRuggedSouthwest-Gallery order=random titlefmt="Wellington's rugged southwest coast" link=TTC/WellingtonsRuggedSouthwest :) ?

Please use (:thumblist count=1 order=random:). [9]. You need to order/shuffle a full thumblist, not a single thumb, but you can display one thumb from this list. --Petko June 30, 2008, at 07:52 PM

OK[10], makes sense, thanks, you are so fast !

Simon

Force thumbnail heights

PS How about a height= to go with the width=. The px= seems to set either height or width depending on context (in table[11], out of table[12]) and I don't seem to get the results I expect.

Done in a development version. Please get it and test it. --Petko July 03, 2008, at 07:18 PM

  • Brilliant! Tested and very happy[13] [14], thanks very much
thanks for the new version, such a professional and useful recipe, Simon

Adding the stylesheet as a file

  • Just put the css code into a file named thumblist2.css
  • Put it into a directory under /pub named thumblist2
  • add the following code to your thumblist2.php
 SDV($ThumbList2Url, 
   (substr(__FILE__, 0, strlen($FarmD)) == $FarmD) 
   ?  '$FarmPubDirUrl/thumblist2' : '$PubDirUrl/thumblist2');

 ##  Add in CSS styles.  
 SDV($HTMLHeaderFmt['thumblist2'], "
   <link rel='stylesheet' href='$ThumbList2Url/thumblist2.css' 
     type='text/css' />
 ");
  • So you don't need to add in the css code into another css file, which generates problems if you are using and changing skins.

---Markus, 11.09.2008, from Germany

Thanks for testing and tweaking the recipe. About the CSS code, it could be added in the file pub/css/local.css. This file is parsed by PmWiki regardless of the skin. --Petko September 11, 2008, at 04:46 PM


Group issue

Petko, thank you for this marvelous concept! I have recently run into a problem, however. Maybe you have a quick fix for it too! ;-) I'm using the (:thumblist usetemplate=1:) markup that works miracles for a really cool gallery.

In my Site.ImageTemplate page I have

!! $[Displaying] {*$UpFile} %p center% {*$PrevLink} [[{*$FullName}?action=browse | $[Back to gallery] ]] {*$NextLink}\\ Attach:{*$UpDirUpFile} (:title {*$Namespaced} / {*$UpFile}:)

The problem is that whenever I create a new page within a group and I upload a picture to that page. If I then use the markup (:thumblist usetemplate=1:) all of the pictures within that group are displayed on that new page, regardless if I have them uploaded to a different page within the same group or not.

I need the pictures to only be displayed on their prospective pages, not the entire host of pictures that are available throughout the group. How do I fix this? I'm using the version of this recipe that I downloaded on the 11th of July, 2008. Within the thumblist2.php file itself it says version "85I".

Thanks, Real Chris October 16, 2008, at 08:06 AM

Maybe I answered my own question. I went to the Uploads page of PMWiki and found that I have to specify in my config.php that it uploads files p/page with this markup:

To organize uploads by page, use:

$UploadPrefixFmt = '/$Group/$Name';

I'll post if that was the issue or not. Thanks, Real Chris October 16, 2008, at 08:20 AM

Yes it is $UploadPrefixFmt. Note that you will need to move your uploaded files from the /uploads/Group folder to a couple of /uploads/Group/Page folders for PmWiki to see them. --Petko October 16, 2008, at 09:16 AM


Link whole galleries through a single thumbnail

Hello Petko, first off many thanks for this great recipe.

I was wondering, if it is possible to link a whole gallery (thumblist) through one thumbnail. Have a look at http://www.samba-osnabrueck.de/index.php/Ansehen/HomePage where I use Thumblist. It would be great if the gallery would open with its first picture (I configured it using lightbox) if I click on the single thumbnail. Is this already possible?

Also, I have noticed captioning doesn't work with lightbox, but I don't use this anyway.

--Jonas July 04, 2008, at 11:58 AM

  • If you want to have a thumbnail linking to an external gallery page, there is the link=Group.Page parameter.
  • Could you add a test page at the site with the current Thumblist version demonstrating the "captioning" problem? (It does not happen for me.)

Thanks, --Petko July 04, 2008, at 03:09 PM


Inheriting the thumbnail caption in Lightbox

I think what Jonas is talking about re: captioning is that Lightbox uses the filename as a caption rather than inheriting the thumbnail caption one specifies in a Thumbgallery. The ability to have it do so would indeed be nice.

--Sean, Aug 20, 2008

This is possible from version 20080821 as shown here. Please get it and test it. (More documentation will be added in a couple of weeks.) --Petko August 21, 2008, at 06:08 AM


Flickr Support

Hello Petko, again many thanks for this great recipe.

I was wondering if you'd be able to add Flickr support in the near future. There is a working recipe for this already, but as you can imagine, I would prefer to have ThumbList deal with Flickr as a picture source. ThumbList is way more flexible than FlickrAlbum. I know it's a whole other story, but maybe you feel like looking into this. It would be greatly appreciated by all of us!

--Jonas December 13, 2008, at 08:14 AM

Hi. I feel "Flickr as a picture source" will greatly limit your control over the displayed files, notably thumbnail sizes, and your independence. Which features of Thumblist you need to use with files hosted on Flickr? Maybe they could be added to the other recipe? The Thumblist code can be reused. --Petko December 15, 2008, at 10:13 PM

Bughunting

Hi. The script seems to be good to me but it doesn’t show thumbnails. It works: shows the names of the files, sizes, dates, times and it makes links but no thumbnails.

I checked probably everything: GD – ok, Permissions – ok, attachlist and attach – ok. The other thumbnail generator MINI is working perfectly. You can look at this example --Andrey October 11, 2008

The creation of thumbnails seems password-protected [15], while it shouldn't be. Try adding in config.php, after including the recipe,

 $HandleAuth['createthumb'] = 'read';

The reason of failure may be this, but it could also be different, while my access is blocked at this point. --Petko October 12, 2008, at 12:52 PM

Holly Molly! I suspected that it was just settings. Thanks a lot! You are the man Petko! --Andrey

I added the 'read' levels for the actions of Thumblist (createthumb, imgtpl) to the new version of the program. It should now hopefully work out of the box. Thanks for your feedback. --Petko October 15, 2008, at 01:55 AM


Relative CSS units

Is it possible to specify px, width, or height with (relative) units (default currently is pixels). Eg width=30% or px=30em?

thanks, simon February 11, 2009, at 01:33 PM, using the latest (and greatest) version

No. These units are relative to the display device, fonts and zoom factor of the visitor which Thumblist cannot know and which differ in most visitors. The pictures have fixed physical dimensions in pixels (colored dots), that's all an online gallery convertor can use. --Petko February 11, 2009, at 03:48 PM


Thumbgallery

I use this recipe a lot on my website ( http://www.jewelwiki.com ). Right now, I display albums a song appears on using the (:thumb:) option. It would be great if I could have all of them be a part of the same Gallery on the page even if they're from different groups:

(:thumbgallery:)
Group1.Page1/pic1.jpg
Group2.Page2/pic2.jpg
etc
(:thumbgalleryend:)

Is it already possible to do this? I was finding that the group and page have to be specified within thumbgallery, but what about different groups? Maybe I'm making it more complicated than it needs to be. Thanks!JewelWiki?

You can have:
(:thumbgallery Group1.Page1:)
pic1.jpg
(:thumbgalleryend:)
(:thumbgallery Group2.Page2:)
pic2.jpg
etc
(:thumbgalleryend:)
One thing this cannot do though is place them both in one table. --Petko March 12, 2009, at 03:09 AM

Ok cool! Thanks! :) JewelWiki?


IPTC/EXIF Enhancements

Please see this recipe : IPTC metadata extraction. It was requested, tested and debugged by user ~Kory.


Alternative link to another attachment

You can do this

[Attach:Data categories.vsd | (:thumb "Data categories.jpeg":)]]

although the thumb link overrides the attached document.

I was sort of looking for

(:thumb "Data categories.jpeg" link="Data categories.vsd":)

Maybe [[Attach:file.vsd | (:thumb file.jpeg link=-1:)]]? Please note that filenames with spaces are not officially or reliably supported. --Petko April 21, 2009, at 05:31 PM

works perfectly, thanks Simon July 30, 2009, at 08:16 PM

Ideas for Autopurge on save

Is there a way to purge all thumbs of a page when the page is saved? Would be nice if there were a checkbox labeled "Purge all thumbs" next to the "This is a minor edit" checkbox. If this checkbox is checked all thumbnails are deleted after pressing the save button.

It would be also nice if thumblist could add a '.' in front of all thumbnail filenames. Then they wouldn't appear in the attachlist. The pagevar {*$NumOfThumbs} could be used to just display the number of generated thumbs.

Can you please describe the structure of the thumbnail's filename? e.g. th120---ffffff--image.jpg.jpg

  • th = thumbnail
  • 120 = size -- height of the thumbnail; Mini thumbs start with "th0"
  • ffffff = background color
  • image.jpg = original filename

But what are all the hyphens for?

Thanks! JL May 07, 2009

Thanks for your comments.

  • Purge on save: too complicated to implement, test and support. What I use is a link in my page Site.UploadQuickReference or in Site.PageActions that allows me to purge the thumbnails. Demo.
  • The filename cannot start with a dot, or the recipe will not work with $EnableDirectDownload set to 0. You can use Attachtable to exclude the thumbnails. I am using an older, simplified version of attachtable with list=(thumbnails|deleted|default), if someone wants it, it is here.
  • The thumb-name should be very improbable for an ordinary file, and predictable and informing about existing thumbnails, that's why this format and hyphens.
  • A pagevar {*$NumOfThumbs} could be added as a separate recipe, it is independent from Thumblist (except for the filename format, which is known).

Thanks, --Petko May 07, 2009, at 05:01 PM


Several Inquiries...

Petko, many thanks on the IPTC extension help. I have run into a few additional issues while incorporating the script into my site. I was hoping you could help with some of these.

  1. When using ImageMagick to produce square thumbnails, ThumbList does not correctly set width and height attributes in <img/> tags. I'm using "htmlpx=0" as a solution, but prefer width/height attributes be included so that elements on a page don't "jump around" while thumbnails load.
    • This would require opening each thumbnail to get its size, which (1) is slow and (2) may be impossible as new thumbnails are created in a separate process that happens after the page is sent to the browser. If all your thumbnails have the same size, you may set in the $ThumbList['_tmpl']['imgwrap'] variable. (info).
      • Yes, I was afraid of that. I'll just live with $ThumbList['HTMLpx'] = 0; in config for now. ~Kory -> mailto:webmaster [snail] herpsofarkansas [period] com May 27, 2009, at 5:00 PM
  2. Given that both GD and ImageMagick can handle multiple formats (JPEG, GIF, PNG), why are thumbnails always converted to JPEG regardless of original format? I think it might be nice if there were some additional options; default perhaps to save the thumbnail in the same format as original, with maybe some options to overwrite.
    • PNG thumbnails, even for line art, tend to have larger file weights (in bytes). JPG is much better for thumbnails of photos, and at least as good for anything else. Other formats are not generally available everywhere. (You can have .png thumbs by adding ext=png to your line, or in $ThumbList['FileExt'].)
      • Sounds reasonable for the most part. I do have a few gifs that I'm having problems with on changing the transparency to match with the background color in the jpg thumb...but this is to do with ImageMagick, not TL. ~Kory -> mailto:webmaster [snail] herpsofarkansas [period] com May 27, 2009, at 5:00 PM
  3. I've tried setting $ThumbList['FileListOrder'] = '-time' in config to overwrite the default sort order, but I'm not getting the behavior I expect. Even without the dash, just 'time', I still don't get the expected.
    • It seems to work for me as expected. Check if your FTP/SCP agent is, or is not, resetting the timestamps on copied files.
      • I haven't looked into this closely yet. ~Kory -> mailto:webmaster [snail] herpsofarkansas [period] com May 27, 2009, at 5:00 PM
  4. Along with the sorting, I was hoping eventually to set up a custom sort function that would first sort by EXIF Date Time Original, then probably by mktime for images without EXIF data. I've skimmed over your page about custom sorting, but any tips or help on this in particular would be appreciated.
    • This will be very slow, but is not impossible. For example:
      function myEXIFtime($filepath){ $time= (your code calculates it); return array('time'=>$time) }
      $ThumbList['stat_dirlist']['etime'] = 'myEXIFtime'; # apply your f if order=[-]etime
      $ThumbList['OrderFunctions']['etime'] = 'return $a["e"]["time"] - $b["e"]["time"];'; # sort by the 'time' key
      I have not more time to look into it now, if you have any problems contact me. (Also, ask yourself do you really need the features you want.)
      • I haven't looked into this closely yet. I guess I have to consider the trade-offs, but this is actually an important feature for me. I haven't attempted to code it yet, but when our group has events--trips and such--with multiple people uploading pictures of what happened...the pictures should "tell a story" chronologically...not just by what file got uploaded first. I think the "truest" date/time should be in EXIF. ~Kory -> mailto:webmaster [snail] herpsofarkansas [period] com May 27, 2009, at 5:00 PM
I user Renamer to prefix the EXIF date and time to the image name (eg) and then sort by filename. --simon June 14, 2009, at 08:47 PM
  1. Is it possible to set a maximum image dimension for my ImageTemplate? If I set width=640 , my portrait pictures are longer than I want. If I set px=640 , my landscape pictures are too wide. I need to set a maximum dimension that applies to both width AND height...so no image displayed is wider than 640, nor longer than 640.
    • SOLVED using ImageMagick and custom imcl. ~Kory
    • You can use px=640 cols=1 which will restrict the medium thumbnails to 640x640 (in a 1x1 table cell).
      • I tried your suggestion as an alternate solution, but doesn't cols=# only work with (:thumblist:)? I would need it in the template to work with (:thumb:). Still, I do already have a solution that works, so it's not a big deal. ~Kory -> mailto:webmaster [snail] herpsofarkansas [period] com May 27, 2009, at 5:00 PM
  2. Also on my ImageTemplate, I was hoping to add a part at the bottom that could be used to copy-and-paste BBC Code for use in a forum...similar to what is provided by PhotoBucket. See here for an example and look to the left menu for Share this image -> more >>, then Get link code -> IMG for bulletin boards & forums. The format would need to be like this: [url=http://www.site.com/url/to/image/page] [img]http://www.site.com/url/to/image/thumbnail.jpg[/img][ /url].
    • Not automatically, but as you only need it in some ImageTemplates, you could do it. For the original:
      [=http://=]site.com/uploads/{*$Group}/{*$Name}/{*$UpFile} (note the [==].)
      For the thumbnails, there could be many for one original, and some could not exist (or be purged), so this is more hardcore.
      [=http://=]site.com/{*$Group}/{*$Name}?action=createthumb&imcl=sqr&upname=th90---ffffff--{*$UpFile}.jpg
      for the thumbnail that is 90px high.
      • I used {*$PageUrl} and it works fine. See here for an example. ~Kory -> mailto:webmaster [snail] herpsofarkansas [period] com May 27, 2009, at 5:00 PM
  3. Is it possible to have multiple image classes? Let's say I want the default class='thumbs' for one thumbnail/list, but I want to use another class (say class='special-thumbs' ) for another thumbnail/list...is it possible?
    • No, but you could wrap them in other elements like:
      >>special<<
      (:thumblist:)
      >><<
      and in pub/css/local.css, you define the different style like:
      div.special img.thumbs { border:4px groove blue; }
      
      • Works. ~Kory -> mailto:webmaster [snail] herpsofarkansas [period] com May 27, 2009, at 5:00 PM

The ThumbList part of my config looks like this:

# Include ThumbList:
include_once('cookbook/thumblist2.php');
$ThumbList['Px'] = 60;
$ThumbList['BgColor'] = "#D8DBB0";
$ThumbList['TitleFormat'] = "";
$ThumbList['UseTmpl'] = 1;
//$ThumbList['FileListOrder'] = 'time';
$ThumbList['fEXIF'] = 'uThumbMetaData';
$ThumbList['ImageMagickExe'] = '/usr/bin/convert';
$ThumbList['IMCLTpl']['sqr']='{%x} "{%P}" -thumbnail "x120" -resize "120x<" -resize "50%" -gravity "center" -crop "60x60+0+0" +repage -quality "{%q}" "{%p}"';
$ThumbList['IMCLTpl']['med'] = '{%x} "{%P}" -thumbnail "640x640" +repage -quality "{%q}" "{%p}"';
function uThumbMetaData($filepath) {
	# get core Thumblist EXIF
	$vars = ThumbExif($filepath);
	# get IPTC tags
	include_once('cookbook/IPTC.php');
	$img_iptc = new Image_IPTC($filepath);
	# get EXIF tags
	include_once('cookbook/pel/PelJpeg.php');
	$pel_jpg = new PelJpeg($filepath);
	if ($pel_jpg->getExif()) {
		if ($pel_jpg->getExif()->getTiff()) {
			if ($pel_jpg->getExif()->getTiff()->getIfd()) {
				$pel_ifd = $pel_jpg->getExif()->getTiff()->getIfd();
				$pel_ifd_model = $pel_ifd->getEntry(PelTag::MAKE)->getText() . ' ' . str_replace($pel_ifd->getEntry(PelTag::MAKE)->getText(), '', $pel_ifd->getEntry(PelTag::MODEL)->getText());
				if ($pel_ifd->getSubIfd(PelIfd::EXIF)) {
					$img_exif = $pel_ifd->getSubIfd(PelIfd::EXIF);
					if ($img_exif->getEntry(PelTag::DATE_TIME_ORIGINAL)) $img_exif_datetimeoriginal = $img_exif->getEntry(PelTag::DATE_TIME_ORIGINAL)->getText();
					if ($img_exif->getEntry(PelTag::EXPOSURE_PROGRAM)) $img_exif_program = $img_exif->getEntry(PelTag::EXPOSURE_PROGRAM)->getText();
					if ($img_exif->getEntry(PelTag::EXPOSURE_TIME)) $img_exif_exposure = $img_exif->getEntry(PelTag::EXPOSURE_TIME)->getText();
					if ($img_exif->getEntry(PelTag::APERTURE_VALUE)) $img_exif_aperture = $img_exif->getEntry(PelTag::APERTURE_VALUE)->getText();
					if ($img_exif->getEntry(PelTag::ISO_SPEED_RATINGS)) $img_exif_iso = $img_exif->getEntry(PelTag::ISO_SPEED_RATINGS)->getText();
					if ($img_exif->getEntry(PelTag::FLASH)) $img_exif_flash = $img_exif->getEntry(PelTag::FLASH)->getText();
					if ($img_exif->getEntry(PelTag::FOCAL_LENGTH)) $img_exif_focallength = $img_exif->getEntry(PelTag::FOCAL_LENGTH)->getText();					
				}
			}		
		}
	}
	# add extra variables
  	$vars = array_merge($vars, array(
		'?x_iptc_headline' => utf8_encode($img_iptc->getTag('Headline')),
		'?x_iptc_caption' => utf8_encode($img_iptc->getTag('Caption')),
		'?x_iptc_copyright' => utf8_encode($img_iptc->getTag('Copyright String')),
		'?x_exif_makemodel' =>  $pel_ifd_model,
		'?x_exif_datetimeoriginal' => $img_exif_datetimeoriginal,
		'?x_exif_program' => $img_exif_program,
		'?x_exif_exposure' => $img_exif_exposure,
		'?x_exif_aperture' => $img_exif_aperture,
		'?x_exif_iso' => $img_exif_iso,
		'?x_exif_flash' => $img_exif_flash,
		'?x_exif_focallength' => $img_exif_focallength,
	));
	return $vars;
}

My ImageTemplate looks like this:

%center% {*$PrevLink} [[{*$FullName}?action=browse | $[Back] ]] {*$NextLink} %%
(:div class=row1 style="width:660px; text-align: center; margin-left: auto; margin-right: auto; padding-top: 10px; padding-bottom: 10px":)
(:thumb "{*$UpDirUpFile}" width=640 imcl=med htmlpx=0 titlefmt="Click for full-size version, if available.":)
(:if ! equal "{*$ThumbList_x_iptc_headline}" "":){*$ThumbList_x_iptc_headline}(:ifend:)(:if ! equal "{*$ThumbList_x_iptc_headline}" "" && ! equal "{*$ThumbList_x_iptc_copyright}" "":) | (:ifend:)(:if ! equal "{*$ThumbList_x_iptc_copyright}" "":)Copyright: {*$ThumbList_x_iptc_copyright}(:ifend:)
(:divend:)
(:div class=row1 style="width:660px; margin-left: auto; margin-right: auto;":)
{*$ThumbList_x_iptc_caption}
(:divend:)
(:if ! equal "{*$ThumbList_x_exif_makemodel}" "":)
(:div style="width:660px; margin-left: auto; margin-right: auto;":)
!!EXIF Data
(:table width=100%:)
(:cellnr class=row2:)Make and Model
(:cell class=row1:){*$ThumbList_x_exif_makemodel}
(:cell class=row2:)Date
(:cell class=row1:){*$ThumbList_x_exif_datetimeoriginal}
(:cellnr class=row2:)Program
(:cell class=row1:){*$ThumbList_x_exif_program}
(:cell class=row2:)Exposure
(:cell class=row1:){*$ThumbList_x_exif_exposure}
(:cellnr class=row2:)Aperature
(:cell class=row1:){*$ThumbList_x_exif_aperture}
(:cell class=row2:)ISO
(:cell class=row1:){*$ThumbList_x_exif_iso}
(:cellnr class=row2:)Flash
(:cell class=row1:){*$ThumbList_x_exif_flash}
(:cell class=row2:)Focal Length
(:cell class=row1:){*$ThumbList_x_exif_focallength}
(:tableend:)
(:divend:)
(:ifend:)

I haven't completely incorporated ThumbList into my site, but you can see what I'm working with on these pages:

http://www.herpsofarkansas.com/Main/2009SpringFieldTrip

http://www.herpsofarkansas.com/Main/AgkistrodonContortrix#Gallery

Thanks!!! ~Kory -> mailto:webmaster [snail] herpsofarkansas [period] com May 16, 2009, at 8:40 PM

If I may suggest, it is recommended to have all custom $ThumbList[] definitions in config.php before including the script (unless there is no way around, such as in a group customization). --Petko May 22, 2009, at 03:41 AM


Thumblist closes <p> tag

The following wiki code will close the <p> tag of the paragraph in which the thumbnail is "embedded".

This is a very long (:thumblist name=test.jpg cols=1 align=left:) text with an embedded thumbnail.

This will result in:

<p>This is a very long </p><table align=left><tr><td><img ..../></td></tr></table> text with an embedded thumbnail.

Is there a way to avoid this. Would be nice if the HTML output would look like this:

<p>This is a very long <table align=left><tr><td><img ..../></td></tr></table> text with an embedded thumbnail.</p>

Thanks! JL May 19, 2009, at 09:05 AM

No it doesn't, but this is the way tables work, and when you set cols=, the output is a table. If you want to have one inline picture, remove the cols= parameter. --Petko May 19, 2009, at 01:31 PM

Thank you for your answer. But cols=1 is the only way to set an alignment because it is then converted to a table image. An alignment is not possible with inline thumbs (Or at least I don't know how). I think the <p> tag handling of PmWiki needs some urgent reengineering. Thanks! JL May 19, 2009, at 02:46 PM

I can align it with %lfloat% or %rfloat% of course. JL May 19, 2009, at 04:00 PM


General Questions

  1. I have a single image with a captionfmt. Why does thumblist add here a table when using (:thumb ...:)? It doesn't do this for a thumblist with a single image which is in my opinion the nicer behaviour.
    • Because this way we can be sure it will display as expected in most browsers (a picture, and below it, the caption). Other methods for this like divs and CSS don't always work, and you can get the same output by adding your caption after the (:thumb:) markup.
      • This means this is only some kind of IE fallback ;-). I hope we can drop this soon as IE8 has really good CSS2 support. JL May 24, 2009, at 04:26 PM
  2. From time to time I get a bunch of "Getting cache for Group.Page, gallery-trail X" Messages. These message are generated in the function ThumbGetCache. They are stored in $MessagesFmt[] but the messages are not wrapped by a html tag. PmWiki or PmForms put their messages inside a tag with the class='wikimessage' attribute. Can you add this please? Or is it possible to disable this kind of messages?
    • They only show when you request them explicitly via a (:messages:) markup. We could add a variable that disables them. --Petko May 21, 2009, at 11:12 AM
    • Added in version 20090522. Add to config.php $ThumbList['EnableMessages'] = 0; to disable these messages. --Petko May 22, 2009, at 03:41 AM
      • Thanks! But keep in mind that the default edit form has the (:messages:) markup to inform the user that an author name is required. Thus on default installs these messages will appear (unformated). JL May 24, 2009, at 04:26 PM
        • I haven't tried the latest version, but I can confirm that these messages show up for me on the edit form...and I do have author name required. Looks like a conflict in markup. ~Kory -> mailto:webmaster [snail] herpsofarkansas [period] com May 27, 2009, at 5:00 PM

JL May 20, 2009, at 10:29 AM


Name patterns for (:thumb:)

Just one more question. Thumblist and thumbgallery commands have the parameter “name=” which gives the opportunity to display files that mach pattern. Like name="paris_*.jpg| france*.jpg". Command “Thumb” – doesn’t. You just have to use exact name like (:thumb Group.Page/My_picture.jpg:). Is there any way to use patterns with (:thumb:)?

Andrey Oct.13 2008

Almost: you can have one thumbnail from a wildcard list with (:thumblist name="*.jpg" count=1:) --Petko October 14, 2008, at 02:20 AM


SuperCache

I seem to be having inconsistent behavior with SuperCache. Not in all cases, but it seems that if I set the supercache for a thumblist on one page and then pull that page up to view on another computer, the thumbnails do not (always) appear. (The problem is not with the browser cache, as I have checked this.)

Any suggestions on troubleshooting? I have several galleries of past events that would be better to supercache, but not if the images don't show up.

Does PmWiki use some caching? (I know, for example, that if I change the CSS file, it doesn't always get reflected immediately)...and so, could this be the culprit?

Thanks.

~Kory -> mailto:webmaster [snail] herpsofarkansas [period] com May 27, 2009, at 5:00 PM

No, there is no reason for this. Is the other computer showing the thumbs with no supercache? Switching computers, after another try, does not necessarily make the difference. It seems perhaps more to do with a time expiration? After setting supercache on a gallery, I kept pulling the page back up for a while and fewer and fewer thumbnails rendered. After about 30 minutes, only about half were rendering. Do they appear in the HTML source? Yes, they show there. Can you display a thumbnail if you enter its url directly in the address bar? No. 404 Not Found. There may be some browser/proxy configuration, I have seen this on aggressive ad-blocking proxy or browser extension (which think thumbs are ads). I'm am getting the same behavior at home and at work. Or, in a server configuration that prevents hotlinking and a browser that doesn't send the correct referrers. I don't recall having anything set up for hotlinking. May need to double-check that, but the behavior is the same in FireFox 2 and IE 6.--Petko May 28, 2009, at 03:25 AM

Thumblist code:

(:thumblist imcl=sqr supercache=1:)

Config code:

$ThumbList['IMCLTpl']['sqr']='{%x} "{%P}" -thumbnail "x120" -resize "120x<" -resize "50%" -gravity "center" -crop "60x60+0+0" +repage -quality "{%q}" "{%p}"';

HTML code (Partial):

<!-- TL2-20090416a --><span class="thumblist"><a href='http://www.herpsofarkansas.com/Herp/TurtleRacesHarrison?action=imgtpl&amp;G=2000&amp;upname=P7040001.JPG' class='thumblink' title='P7040001.JPG' >

When I edit and preview (or possibly just edit?) the page, the thumbnails get restored. However, after the thumbnails get restored, shouldn't I see a bunch of thumbnail files (th60---D8DBB0--P7040086.JPG.jpg, etc.) in the folder? If so, they are not there.

I'll keep trying to pin it down, but whatever it is is definitely a conflict with the supercache. The thumbnails always work without supercache set, but eventually stop working with supercache on.

Ok, I had such a rare problem with caches, when the front-end server (apache+php) uses another filesystem server, and their clocks are not synchronized (+/- 5 min). The wiki page has a timestamp of the PHP server, as an internal page attribute, which Thumblist reads, and the cache and thumb files have timestamps from the filesystem server. If the cache seems older than the page, it is re-created, otherwise it isn't. Could be this such a case?

Edit: Just noticed one additional strange thing. With supercache set, the imagetemplate page seems to NOT recognize any "forward" or "backward" images, but with supercache off, the "forward" and "backward" ARE recognized.

Confirmed, it's a bug and I'll look into it soon. I am unable to reproduce the bug. Could it be related to the filesystem stamps too? --Petko June 15, 2009, at 07:57 AM

(Off topic) - What is the "imcl"? "ImageMagick Convert L?"? ...command line

Thanks. ~Kory -> mailto:webmaster [snail] herpsofarkansas [period] com May 29, 2009, at 11:20 AM


Rotate thumbnails from the EXIF orientation tag

Would it be possible to have ThumbList honour the EXIF orientation tag[16]? thanks (example)

It might be possible, if someone writes a function replacing the ThumbCreateGD() function. But even then, when your visitors click on the thumbnail to get the original, they will see in their browser a picture with the wrong orientation. It may be better to rotate the originals before uploading them to the wiki. --Petko June 15, 2009, at 07:57 AM

Personally I would suggest that this is a browser bug (and I have reported it as such to 4 major browsers), and it is a recognised issue in XP and Vista, but works in recent versions of the mac[17], thanks :-) --Simon June 16, 2009, at 05:02 PM

One may argue that this is a camera bug : why add some tag when the camera could rotate the picture instead? :-) Some cameras, e.g. Kodak, can be configured to save vertical pictures vertically. --Petko June 20, 2009, at 06:09 AM

true :-) --simon June 20, 2009, at 02:02 PM