Back to Cookbook.Thumb list
- You can tell me here what you think about the Thumb list recipe. --Petko December 12, 2006
- You can link your galleries in the "Examples" section on the main page. --Petko
Latest versions
Tips
- Always get the latest official release of the script (currently: version 20100315).
- ensure the PHP image functions (GD) are enabled in your
php.ini (for Windows)
- change
extension_dir from its default value to the directory where your extensions are (files like php_gd2.dll, iconv.dll and other DLLs)
- set
extension=php_gd2.dll (if there is a semicolon ";" in front of it, remove it), then restart Apache
- How to display random thumbnail(s)
PHP is not meant to do heavy image processing, so the thumbnails may not work with very big images (sometimes 2 megapixel max: 1600*1200). If you have problems with some pictures, try to resize them down a little: a picture of 1000*750 pixels is more than enough for most visitors' screens.
Your files must be visible to PmWiki, so be sure to have (1) a PmWiki uploads directory structure and (2) a file name allowed by PmWiki. The easiest way to do it is by uploading a file through the "Attach:" link on the wiki page and see if it was renamed (i.e. lowercase extension). This way PmWiki will also create the uploads directory, so you can browse there by FTP and copy your pictures more easily.
Archive
- To read the older threads of this page, please visit ThumbList-Talk-archive with comments from Dfaure, Simon,HaganFox, Pico, Hua,Han,BillReveile, SteP, Diafygi,RussFink, Skumar?, FritzWebering,RealChris, JewelWiki?, JL?
Recent discussions
Add a new section and a brief description at the bottom of the page. Please mention if you are using the latest version, and if possible, link any webpages if needed. --Petko
If you write about a problem, linking here your example galleries greatly speeds the diagnosis and the fixes.
You can sign by adding ~~~~ (four tildes) at the end of your post, which will be translated to your name and the date. --Petko
Group.Page to link gallery from other pages or from other group
I Petko ! It is said, in your doc, that « If you need to create a gallery of pictures uploaded in another Group (or Group.Page, depending on your wiki settings), add it immediately after thumblist or thumbgallery: (:thumblist Group.Page:) ».
Isn't it an automatic way to make thumblist program always use, by default {{$Group}}.{{$Name}} or the $UploadPrefixFmt (so one doesn't need to write explicitly where are the pics) ? My motivation, here, in my case, is I forgot to use Group.Page param for thumblists : so I'm in trouble for showing some pics on pageA (pics are on pageB, pageC, etc.) I know it is easy to solve this with mass search and replace but my question is : isn't it a config or php way to make (:thumblist:) use by default $UploadPrefixFmt ? Thank you. --gb March 02, 2010, at 10:01 AM
It uses $UploadPrefixFmt, only it needs to know where your pictures are. If you have (:thumblist:) without Group.Page, it assumes the pictures are attached to the page you're viewing, like if you had (:thumblist {*$FullName}:). To display pictures attached to other page, use (:thumblist OtherPage:). If the documentation is not clear enough, we should improve it. Or may be I don't quite understand your problem? --Petko March 02, 2010, at 12:56 PM
Thumb List Templates: Problem with Upload Directory
Hi Petko, i use the latest Thumb List with automated ImageTemplate creation if you click on a Thumbnail.
It all works so far, but i discovered a problem with the upload directories and image paths. I try to explain
step by step what i did: First of all, my upload directory configuration is by page, using $UploadPrefixFmt = '/$Group/$Name';". in config.php. I created the page "Site/ImageTemplate" and included (:include Site.{*$UpFilePage}:) [[Site.{*$UpFilePage}(?action=)edit]]. At my main gallery page i use ThumbList with this code: (:thumblist cols=3 order=-name name="thumb_*" captionfmt="?f ?N ?N" usetemplate=1:). On click at one thumbnail, i get a new individual page.
For example, the main gallery has the path:
http://localhost/pmwiki/pmwiki.php/Site/Test, if i click on thumbnail "thumb_01.jpg" i`ll get the path:
http://localhost/pmwiki/pmwiki.php/Site/Test?action=imgtpl&G=1&upname=thumb_01.jpg. This new page shows the link:
Site.thumb_01jpgedit. If i click on it, i`ll get a new page: http://localhost/pmwiki/pmwiki.php/Site/thumb_01jpg?action=edit. Everything works fine so far. I include ThumbList again at this new page using this code: (:thumblist cols=3 order=name name="gal_*" captionfmt="?f ?N ?N" link=-1:). I upload my pictures (gal_01.jpg-gal_09.jpg for example) to the page "Site/thumb_01jpg". Now there is the problem: Everything works fine at page "Site/thumb_01jpg". But if i go back to my main gallery page: "Site/Test" and click on "thumb_01.jpg" i still get the path: http://localhost/pmwiki/pmwiki.php/Site/Test?action=imgtpl&G=1&upname=thumb_01.jpg and ThumbList cant find the images name="gal_*" because it tries to receive the images from path "Site/Test" and not from the original upload directory "Site/thumb01jpg".
I think its possible to solve this problem if i switch the upload directory to sidewide. Is there any chance
to get this working without changing the upload directory? I hope you understand my problem, my english is not the best. ;) Thank you very much! - Michael, February 4th, 2010.
Hello. The {*$UpFilePage} page was really not intended to contain other thumbnails, but to contain descriptions or comments about one picture, which are included from the ImageTemplate, just a technical page. If you add more stuff in it, especially other thumblists, your setup may become so messy that even you may not be able to manage. Ask yourself if you really need what you want -- or you prefer the simplicity and the serenity. So, my advice is to try keeping things as simple as possible.
About your question, you can list thumbnails attached to a different page with this command:
(:thumblist OtherGroup.OtherPage [other options]:)
in your case, inside the included page, you can use (:thumblist {$FullName}:) which will be automatically expanded to Site.Thumb01jpg. --Petko February 05, 2010, at 08:56 AM
P.S. Note that the Site.* wikigroup was intended for the software interface -- if you can, you'd better use other groups for your content. Also, in your case -- a gallery leading to other pages -- it may be more convenient to use in the template not Site.{*$UpFilePage}?action=edit but {*$FullName}-{*$UpFilePage}?action=edit which will name the subpages Main.Test-Thumb01jpg and Main.Test-Thumb02jpg. In the long run, this may be much easier to manage. --Petko February 05, 2010, at 08:56 AM
Petko, thank you very much for your detailed reply! To solve the problem described above, i used your suggestions and played with the code a bit:
At Site.ImageTemplate i included:
[[Pics.{*$Title}-{*$UpFilePage} | Click here to Edit this Page.]]
(:include Pics.{*$Title}-{*$UpFilePage}:)
At the NewGalleryPage (Those new pages if i click on a thumbnail at the main gallery)
i included:
(:thumblist Pics.{*$Title}-{*$UpFilePage} cols=3 order=name name="gal_*" captionfmt="?f" link=-1 quiet=3:)
Now the new Gallery pages will be saved in ''Pics.{*$Title}{*$UpFilePage}''.
For example: The main gallery hast the path Main.Gallery1, the name of the
thumbnail i want to create a new gallery for, has the name "thumbnail1.jpg".
The final path is: ''Pics.Gallery1thumbnail1jpg''.
Now i get the following errors at "Site/ImageTemplate":
Warning: htmlspecialchars() expects parameter 1 to be string, array given in G:\apache\htdocs\pmwiki\cookbook\thumblist2-actions.php on line 210
Warning: Cannot modify header information - headers already sent by (output started at G:\apache\htdocs\pmwiki\cookbook\thumblist2-actions.php:210) in G:\apache\htdocs\pmwiki\pmwiki.php on line 1064
What does those errors mean and how can i fix them?
Thanks again for help! - Michael, February 21th, 2010.
First, I'd suggest using the {*$Name} variable instead of {*$Title}, see Page variables. $Name is fixed and unique for a given page (gallery) while $Title can be changed, and then your links and includes will stop working. Second, it looks like you are using an older version, if it is the case, you can upgrade -- update both files thumblist2.php and thumblist2-actions.php. If it still gives the warnings, do you have some custom question-variables defined, and how? (Something could be optimized there.) --Petko February 21, 2010, at 06:25 AM
Lightbox going through all images not only the one which are displayed with the perpage-option enabled
Hello Petko, I'm using the latest version of thumblist (20090831) and I want to use the lightbox with the perpage-option. For example I have 15 images and set the perpage-argument to display 3 images at once, so 5 pages a 3 images will be created. If I switch on some page, then Lightbox show me only 3 pictures and I must close the javascript window to switch to the other page. Is it possible to navigate for and back through the whole images without clicking on the next page to see the other pictures. So if I'm on page 2 and looking at the first picture and I want to see the last picture of page 1, I just must click the back-button on the javascript-window to turn to the images of the first page (the very same is for the for-button in the javascript-window). Hope you understand my concern, if not I will post some images :)
--MatthiasGünther October 05, 2009, at 12:29 AM
Not if you use the
perpage= parameter, but it may be possible if you use one visible and one hidden thumblists:
(:thumblist count=3:)
>>comment<<
(:thumblist count=4.. :)
>><<
The first one will display pictures 1-3, the second one will be hidden, but it contains pictures 4-15 and Lightbox should show them. (I say "should" because the same works with Mini -- it should work with Thumblist too.) --Petko October 05, 2009, at 07:05 PM
It doesn't work for me, but I get nearly a solution with mini which also works for the perpage setting. I use the following:
Mini_Slice:4,*
SubPagesMini:3
>>comment<<
Mini:*
>><<
So maybe you could add this feature in the next version.
--MatthiasGünther October 05, 2009, at 11:58 AM
Lightbox integration, changing <img> title to caption.
If you have integrated LightBox and want it to show picture's captions as comments in fullsize view (instead of file name), please change #73 string in thumblist2.php to
'awrap' => '<a href="?L" class="thumblink" title=" ?3" %2$s>%1$s</a> ',
You can find an example web.finar.ru/pmwiki.php
I'am not shure that it is very correct way, can anyone suggest better way?
Finar.
You shouldn't ever need to modify the script files, almost everything can be changed with variables in config.php, and the program should continue working if you upgrade to a newer version. In your case, here is the code to use:
$ThumbList['_tmpl']['awrap'] = "<a href='?L'
class='thumblink' title='?4' %2\$s>%1\$s</a> ";
Instead of ?3, I recommend using ?4 which escapes some special characters. --Petko August 17, 2009, at 10:02 AM
Thanks, Petko! OK, I did as you said and it's work OK. But now I made up my mind to use ?2 istead of ?4 (because of this way I can use description to image without caption.) In this case if I have no "title" specified, I get "?f: ?wx?h, ?kk (?t)" istead of my description in Lightbox. I can manually solve it by adding
#307: $_lightboxtitle = (@$arr['_t'])? $arr['_t']: ' '; and
#325: "?5" => $_lightboxtitle, and than use ?5. But as you said it is not correct way, what is better for this problem?
Finar.
You can disable the default title format (which is "?f: ?wx?h, ?kk (?t)") by adding to config.php such a line:
$ThumbList['TitleFormat'] = '';
This way, if you have image.jpg"Some title" it will appear as a lightbox caption, if not, it will show nothing. Is this what you are trying to achieve? --Petko August 17, 2009, at 12:59 PM
Not exactly. The way you suggested will show tooltip only if it was manually added. In my example above with $_lightboxtitle variable (you can see it working now on web.finar.ru/pmwiki.php) standart tooltips (e.g. "a2.jpg 800x600 ...") are shown even if no "Some title" was specified. After specifing "Some title" it will be shown instead of standart tooltips
Finar.
I modified the script to process the ?1-?4 variables before the other ones; if ?1-?4 contain some other ?variable, it will be reprocessed. Could you test the new version and report any problems? Thanks. --Petko August 17, 2009, at 02:30 PM
Oh, thank you very much, Petko! I've tested it and it looks like it works as I was expected! I'm very happy now :)
Finar.
Example of $ThumbList['EXIFvars'] .
Do I simply say $ThumbList['EXIFvars']['O']='IFD0.Orientation'; [1]
in config.php and then use ?O?
thanks
simon August 12, 2009, at 06:03 PM
If I read correctly the tag list, it should probably be 'IFD0.Orientation' (untested), also note that the ?question variables are case-sensitive. --Petko August 13, 2009, at 08:55 AM
Thanks Petko, examples above corrected
simon August 13, 2009, at 07:30 PM (additional note - using uppercase or lowercase Oh doesn't work for me, I had to use zero!)
Right, but the ?0 shouldn't work either. We have discussed that adding custom ?variables could interfere with future Thumblist versions, and decided to keep ?x* as a prefix for extended variables. I recommend using ?x_orientation or just ?xo in your wiki. --Petko August 17, 2009, at 10:18 AM
Thumbgallery seems to have a bug.
When I make a Thumbgallery with the option usetemplate=1, only one of the images will be opened correctly. All of the other thumbnails open a template page with no image in it. This seems to be not the case on the ThumbList homepage, though. See an example at http://discographydb.info/wiki/Main/WikiSandbox.
Though the links look OK on all thumbnails, they show different behavior. When I leave out "usetemplate=1" then both links work.
thanks, Markus
Would it be possible to have the edit link enabled and the password removed from this example page, thanks, Simon
There may be a bug indeed: I'll try to find some time to investigate it. Meanwhile, you can create an "image template" page, eg. "Site.ImageTemplate", as explained in the recipe. --Petko October 17, 2009, at 02:55 AM
Could you try a test version of the thumblist2-actions.php file? (Just replace the one in your pmwiki/cookbook directory.) if it works, I'll release a new version. --Petko October 21, 2009, at 06:31 PM
Support for other image types
Is it possible to enable support for the tiff image type
thanks, simon October 17, 2009, at 02:00 AM
No, neither PHP/GD can read TIFF images to produce thumbnails, nor the browsers can display TIFF images. Convert them to PNG or JPEG. --Petko October 17, 2009, at 02:55 AM
There might be a bug with (:thumbgallery:) markup:
(:thumb Gr./img.jpg:) leads to /Gr/Gr?action=upload&upname=img.jpg,
whereas
(:thumbgallery:)Gr./img.jpg(:thumbgalleryend:) leads to //?action=upload&upname=img.jpg
-- Rogutės, 2009-10-21
No, it should be written like (:thumbgallery Gr. :)img.jpg(:thumbgalleryend:) - and you don't have to write Gr./ at all img.jpg lines. On the other hand, you cannot mix files from different groups in one thumb list/gallery. --Petko October 21, 2009, at 02:00 PM
To add a download link to the original full size image under each thumbnail
(:thumblist captionfmt="[[?U|download]]" supercache=1:)
simon November 12, 2009, at 02:55 AM
Template Trails and Named Anchors
Is there a way to get a template trail and image template to retain a named anchor?
For example, when jumping to the gallery portion of a page...
http://www.herpsofarkansas.com/Snake/AgkistrodonContortrix#Gallery
But the template trail offers a link...
http://www.herpsofarkansas.com/Snake/AgkistrodonContortrix?page=2
This causes the page to jump back to the top. What it really should offer is...
http://www.herpsofarkansas.com/Snake/AgkistrodonContortrix?page=2#Gallery
The situation is similar using a "Back" link in an image template:
[[{*$FullName} | $[Back] ]]
Thanks. kaptainkory December 22, 2009, at 11:46 PM
In the ImageTemplate, can't you have a back link like [[{*$FullName}#Gallery | $[Back] ]] ? --Petko December 24, 2009, at 01:22 PM