Mini-Talk

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

For a new question, please add a new section at the top of this page. --Petko

switch off img creation

I run my wiki in two instances. Once locally and once on the server. I want Mini to create thumbnails and resized pictures locally and then copy the generated files to the server. However, the copy to the server updates the updatetimestamp, thus, Mini tries to recreate certain images. To avoid that, I patched mini, to switch on and off regeneration of images by a variable in local/config.php. I like to share the code with anybody needing it. wlkl

Caption and Tooltip from different IPTC fields?

Can I get the caption from IPTC Headline (IIM 105) and the tooltip text from IPTC Description (IIM 120)?

The IPTC Description (abstract) is usually too long to be used as caption printed below an image, but it might be well suited for a tooltip box.

OliverBetz 20161002

Sorry, this is currently not possible. It would require a careful change to both the IPTC recipe and to the javascript file. You might be able to adapt the uMini_IPTC() function to return both iptc variables separated with a line break, and use CSS to only show the first line in the lightbox. Something like #unav+b {white-space:pre; height:1em; overflow:hidden;} or a variant. --Petko October 02, 2016, at 11:53 AM

PHP exception

SteP 20151101 - My error logging function shows:
Type: ErrorException; Message: Undefined offset: 3; File: /pmwiki-2.2.78/cookbook/mini.php; Line: 112;

for markup (:Mini1:{$Name}-p1/*:) with Mini version 20150925, PHP 5.5.15, and error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); Lines 111-112:

  if(preg_match("/^(Mini)(\\d)(_\\w+)?:$/i", $imap, $m) ){
    $imap = "{$m[1]}{$m[3]}:"; $pxidx = intval($m[2]);

from which I gather that the third regex capture yields an undefined array index (3). Can this PHP exception be avoided while keeping Mini's intended behaviour? How so? Thanks.

Try inserting a "@" like $imap = @"{$m[1]}{$m[3]}:"; This should suppress the notice. Why would one enable PHP notices? --Petko November 01, 2015, at 04:49 AM

Thanks. Even if I remove E_NOTICE from the error mask I'm still getting the exception message, with or without "@". It could be my error handler's fault, though - my knowledge of PHP error handling is very limited. I'm enabling E_NOTICE to chase a bug of mine.

Can you test it with this code: $imap = $m[1] . (count($m)==4? $m[3]:"") . ":"; --Petko November 01, 2015, at 11:30 AM

That code works fine, no more exception. Thanks.

Released version 20151101 with this change. --Petko November 01, 2015, at 02:56 PM

No ultralightbox functionality in ajax loaded text

I use the ajax command (_.ajx) of the unverse library for a fast loading of additional text after a page is already normally loaded. The ajax call is activated by the visitor via a pagelist link. If a mini image link is included in the additional ajax loaded text the ultralightbox functionality doesn't work. In the rest of the page ultralightbox works fine. Any idea what to do?

Thanks, Siegfried, 2015-02-03

You need to call the _.Ui() function with parameter an array containing the newly added minilink link elements. Something like this (untested):

  _.ajx('file.html', YourContainerElement);
  var lst = _.c('minilink','A', YourContainerElement);
  if(lst.length) _.Ui(lst);

Hope that helps. --Petko February 03, 2015, at 09:07 AM

Thank you for the tip. To get it working I had to include a timeout, to wait until the asynchron loaded ajax call has finished:

    _.ajx("file.html", "YourContainerElement");
    setTimeout(function() {
      var lst = _.c("minilink","a","YourContainerElement");
      if(lst.length) {_.Ui(lst); }
    },1500);

  -- Siegfried, Februar 03, 2015

Indeed. It is a pity that the _.ajx() function doesn't accept a 'function' parameter to be launched on the Ajax reception. --Petko February 04, 2015, at 03:07 AM


How to disable default title=filename behavior?

Hello again!

Is there any way to make this Mini:picture.jpg"-" behavior be default for all pictures without manually specified title?
I need it because we don't use Cyrillic for files naming (and this is right idea), so most of images filenames are meaningless.

Thanx!

Finar, 2014-07-31

Something like this in config.php should work: $Mini['FNameRPat'] = array("/^.*$/"=>''); --Petko July 31, 2014, at 05:43 AM

Yes, it works, thank you very much! :) Finar

How to add some class to surrounding DIV?

Hi! As I see Mini creates a <div> around images list. Is there any way to add some class to this <div>? The very best idea is to give class named similar to type of Mini was used: <div class='Mini'>, <div class='Mini1'>, <div class='Mini2'>, ect. Thanx! Finar, 2014-07-06

You have different $Mini['ImgFmt#'], $Mini['LinkFmt#'], $Mini['MiniFmt#'] (#=0..9) html templates for the different Mini0:..Mini9: advanced galleries settings.
In your config.php add :
     include_once($FarmD.'/cookbook/mini.php');
     $Mini["MiniFmt"] = "<div class='Mini'>%s</div>";
     $Mini["MiniFmt0"] = "<div class='Mini0'>%s</div>";
     $Mini["MiniFmt1"] = "<div class='Mini1'>%s</div>";
     $Mini["MiniFmt2"] = "<div class='Mini2'>%s</div>";
     ...
AntonyTemplier July 06, 2014, at 04:35 PM
Thank you, AntonyTemplier! A a matter of fact this creates another one <div class='MiniX'> inside main <div>. That is no perfect, but practically works for me Finar

Double suffix

Note that generated thumbs have double suffix (Name.jpg.jpg). You may want to check line 221 in mini.php to adjust. $mupname = "th0$idx---$upname.jpg"; Hugh (5/2014)

The thumbnails are always in the JPEG format, so this change may be fine if your galleries only have JPEG pictures (originals). But on other wikis, if people have GIF or PNG uploads, the change would generate JPEG thumbnails but save them with *.png or *.gif extensions, which would be wrong, and the server would sent the incorrect content-type headers to the browsers, some of which may refuse to display the thumbnails. --Petko June 27, 2014, at 11:45 PM


Change opacity of ultralightbox background

Is there a way of changing the opacity of the ultralightbox background?

I'd like it a bit more dark and therefore tried to change some values in ultralightbox.js but with no luck. :)

TomG 2014-02-25

This is hardcoded in the unverse.js library. To override it, place in your file pub/css/local.css such a line: #uv_ov{opacity: 0.9 !important;} The number after opacity: should be between 0.0 (transparent) and 1.0 (opaque). --Petko February 24, 2014, at 11:45 PM

Spooky timezones. :) Perfect, thanks! TomG February 25, 2014, at 02:23 AM


Trying to include page with Mini having detailed tooltip titles

Considering this in my config.php:

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

I use this working syntax in order to include a page in another one :

Mini:Group.Page/file*.jpg"Global title"

But when I try with detailed tooltip titles, it doesn't work :

Mini:[=
Group.Page/file1.jpg"Title of file1"
Group.Page/file2.jpg"Title of file2"
Group.Page/file4.jpg
Group.Page/file3.jpg
Group.Page/file5.jpg"Title of file5"
=]

Any suggestions ?

AntonyTemplier December 13, 2013, at 08:24 PM

Mini:Group.Page/[=
file1.jpg"Title of file1"
file2.jpg"Title of file2"
file4.jpg
=]

Place the "Group.Page/" part before the "[=...list of files...=]" part. --Petko December 14, 2013, at 02:11 AM


No rebuild of thumbnails with restricted user actions

It should be noted that "action=mini" is needed to rebuild thumbnails.

I have a club site where guests have restricted rights, using this line in config.php:

 if (! in_array($action, array('browse', 'search', 'login'))) { $action='browse'; }

and of course, mini didn't rebuild thumbnails when guests were viewing until I added 'mini' to the allowed actions.

OliverBetz 20121212

Thanks, added to the Notes section. --Petko December 12, 2012, at 05:29 PM

display full size, but include in mini-gallery

Is there any way to display the full-size image (as one would do with Attach:image_name.jpg), NOT display a separate mini-thumbnail, yet still have the image appear in the pop-up gallery?

One solution would seem to be to set the thumbnail size for that image ONLY to be "full-size"

Another solution would be to have a "hidden" mini linkMini:image_name.jpg that does not render visibly, but still would appear in the mini-gallery.

Bonus points for having the full-size image clickable to launch the mini-gallery (as would be the case with a "full-size" thumbnail).

Example: the first two images on this page I want to display full-size. The third-image, display a thumbnail. BUT I would love to have ALL THREE appear inside of the mini-gallery.

MichaelPaulukonis December 11, 2012, at 09:36 AM

This is probably not impossible, but certainly very complicated. Why don't you settle for something between the two? Like having middle-sized uncropped thumbnails. Set in the page something like this:

(:mini m9=0x150:)
Mini9:[=
OverlayedSymbols.jpg"NYT: Why Do Educated People Use Bad Words?"
cant_spell_it_and_not_allowed_to_say_it.gif"Can't spell it and not allowed to say it"
all_those_stars_and_beeps.jpg"All those stars and beeps"
=]

This will create "proportional" thumbnails all 150px high and not cropped but scaled proportionally, each with its own title. (You may want to link to the sources at the end/footnote of your article for example.) Note the "9" in the Mini9: part which will use the setting/size "m9" from the (:mini m9=0x150:) directive. See Mini#custom and the last example from AdvancedUsers. --Petko December 11, 2012, at 03:46 PM

Just note that if you change the sizes of the thumbnails, for example first m9=0x150, then test with m9=0x200, you need to purge the existing thumbnails. --Petko December 11, 2012, at 03:46 PM

Strange non-printable link appears at end of image list

At the lower right corner of the last photo in any Mini list, I get a small question mark denoting a link to create a non-existent page (ex: http://localhost/wiki/index.php?n=REACCH.%9d%9d3L%9d%9d?action=edit). I'm trying this with a simple Mini:somestring_* call - no options or fanciness.

  • The ? appears after every Mini invocation and is not affected by different Lightbox enable options. Actually, LB appears to be working fine.
  • It targets a bogus page name. Also, the %9d is noticeably odd: there is no associated glyph in the extended ascii set. (Well I guess it could be blank but there are ~five 'blank' glyphs in ext. ascii)
  • Two links are built with this page name, one wrapping around all the thumbnails & links produced by Mini and the other appearing afterwards.

Here's a example of the generated HTML source (with extra line breaks for clarity):

<div><a class='createlinktext' rel='nofollow'
    href='http://localhost/wiki/index.php?n=REACCH.%9d%9d4L%9d%9d?action=edit'>
<a href="http://localhost/wiki/uploads/REACCH/PhotosFromCFNT/photo_CFNT_20120215_083626.jpg" 
    class="minilink" rel='lightbox_mini_1' title="photo CFNT 20120215 083626">
  <img class="mini" src="http://localhost/wiki/uploads/REACCH/PhotosFromCFNT/th00---photo_CFNT_20120215_083626.jpg.jpg" 
      title="photo CFNT 20120215 083626" alt="photo CFNT 20120215 083626" border="0" />
</a>
<a href="http://localhost/wiki/uploads/REACCH/PhotosFromCFNT/photo_CFNT_20120215_083633.jpg" 
    class="minilink" rel='lightbox_mini_1' title="photo CFNT 20120215 083633">
  <img class="mini" src="http://localhost/wiki/uploads/REACCH/PhotosFromCFNT/th00---photo_CFNT_20120215_083633.jpg.jpg" 
      title="photo CFNT 20120215 083633" alt="photo CFNT 20120215 083633" border="0" />
</a>
</a><a rel='nofollow' 
    class='createlink' href='http://localhost/wiki/index.php?n=REACCH.%9d%9d4L%9d%9d?action=edit'>?</a></div>
Edit: I just noticed the number preceding the L is different for each link - the other Mini gallery on that page has a 12 instead (REACCH.%9d%9d12L%9d%9d)

Any ideas where these could be coming from? --pokeeffe? August 30, 2012, at 02:48 PM

The %9d%9d[Number][Letter]%9d%9d thing is a holder for an intermediate string saved by the PmWiki Markup engine to avoid further processing. It looks like something - could be Mini or another recipe - thinks this internal string is a valid page name and tries to create a link to it. Does it happen when in the page you only have only a single Mini: markup and nothing else? Do you have some local customizations that concern links or InterMap links, or WikiWords? --Petko August 30, 2012, at 04:39 PM

Yes, it appears when both one or several Minis are present. My current active recipes are AddNewline, AutoTOC, Callout, ExternalLinks, Mini, PreviewChanges, and SimpleDiscussLink. I think ExternalLinks is the most likely cuprit; I see your note on its page regarding Attach: and Path: links but that solution doesn't address this issue. That is, I customized the Attach: display format but the ?s after each Mini persist. --pokeeffe? August 31, 2012, at 03:27 PM

Can you test the latest version (just released)? If it doesn't fix the problem, you can disable all your customizations from config.php one after another, and refresh the page to see if at some point the problem disappears - if it does, it is likely that the setting you just disabled either caused, or had some influence to the problem. Other than that I don't see how could I debug it without looking/editing the files in real time. --Petko August 31, 2012, at 04:42 PM

$Mini[FixFilenames] will not remove <sp> from the filename being uploaded.

The uppercase ext gets converted to lowercase but the <sp> are left in the uploaded filename. I put the "$Mini[FixFilenames] = 1" in the config.php file before and after I included_once mini.php and it made no difference. What is the best way to debug this problem?

By <sp> do you mean spaces? It should be $Mini['FixFilenames'] = 1; with 'FixFilenames' surrounded by apostrophes. Additionally, Mini will rename the files not when you upload them, but the first time when it tries to create thumbnails from a wildcard list. So, after attaching the files to the page, use for example Mini:*.jpg in the wiki text, this should rename the files. --Petko May 13, 2012, at 05:54 PM

I added a step to the basic installation instructions to keep mini from looking broken

It is useful to know, when the lightbox does not work, and all the helpful steps further down have been checked, that the default in mini.php is $Mini['EnableLightbox'] = 0, which is to disable the lightbox, and that unless one adds $Mini['EnableLightbox'] = 1; (or 2, or 3) to local/config.php, it will look broken.

The function of this switch is spoken of in the recipe, but its importance and necessity as an ingredient is not spelled out.

Thanks. --Petko February 14, 2012, at 09:04 AM

Link to page images are attached to?

Is it possible to link to the page an image is attached to?

   mini:Posters/*_preview.png

Would show a gallery of all poster previews and then link to each of the pages in the Poster group the preview images are attached to. Ideally, the title of the page would also be used as a caption.

If you have per-group upload directories (this is the default setting for PmWiki), there is no way of knowing to which page a file was attached. It may be possible to create a PageList (which will list/link the pages in your Posters group) but you may need to indicate in each page which pictures are related to it. What is the content of your Posters pages (their wiki sources)? --Petko October 10, 2011, at 06:28 PM

Thanks for this, Petko. I ended up hacking YAG a bit and got it to do what I wanted, more or less. --Jboy

Is it possible to returning "false" or "0" or "" if no images are found?

Hi Petko. let's say i have a Group with a GroupHeader (or GroupFooter) like so:

   !! Image Gallery for {*$Name}
   Mini:{*$Name}*.jpg

i'm discovering it would be nice if i could detect whether or not Mini will find and display any images so that a page with no associated images could then suppress the header of "Image Gallery for ThisPage" (or whatever other info). i'm imagining i could do something like this by wrapping the above in something akin to:

   (:if !equal "Mini:{*$Name}*.jpg" "":)
   !! Image Gallery for {*$Name}
   Mini:{*$Name}*.jpg
   (:ifend:)

is something like this in any way possible? thanks. overtones99 June 28, 2010, at 07:17 PM

You may be able to use a custom conditional like (:if attachexists {*$Name}*.jpg:), see an implementation. --Petko June 29, 2010, at 03:27 AM

Alternatively, you can enable and use the Title and text around the gallery feature like this:
Mini:{*$Name}*.jpg"Image Gallery for {*$Title}|"
It will only display a title if there are pictures. You can style as you like the .miniH entry in local.css. --Petko June 30, 2010, at 06:25 PM

Picture name under Thumbnail & Automatic Link to new Page?

I have hundreds of images in multiple galleries. i use "mini:*" tag to automatically create those galleries in my pages and it works great, this saves a lot of time!
Now following features would be a great additional benefit:
1) automatic output of each individual image name under each thumbnail picture.
for example: "picture001.jpg" is related to thumbnail with name "th00---picture001.jpg". under this thumbnail image it automatically generates the name of the original source: "picture001".
2) automatic link creation to a new page that is related to each thumbnail picture.
for example: lets name a picture "image001.jpg". on click on it, it directs me to a new page with name "image001". so i dont get a larger version of the picture but a new site where i can add more information, orginal file etc.
Would be really great if those features are possible! Thanks for info! Jack, January 20, 2010, 04:22 PM

Hello - and sorry for the late reply. I am glad to hear that Mini saves you a lot of time. Unfortunately, the features you ask for are not implemented. Both are possible with ThumbList though, (1) is enabled by default, and (2) can be done with an ImageTemplate which contains the line (:include Group.{*$UpFilePage}:) [[Group.{*$UpFilePage}(?action=)edit]] -- this is an advanced feature and needs a little work from you. Good luck! --Petko February 01, 2010, at 10:24 AM

Thanks again! works perfect for me! :) - Jack

Lighbox tweaks???

if i replace the bundled Lightbox javascript with a newer version it stops working in Pmwiki. so i am guessing you have tweaked the bundled Lightbox code Petko? if so, can you document the necessary changes? i ask because i am seeing some odd behavior of the Lightbox close link: it often responds to a click by moving a bit to the left and not closing the image overlay til a second click. anyone else see this? if not, what could i be doing wrong? tia!!! /dan - bang December 17, 2009, at 02:43 PM

Yes, there are some changes for the script to work with the PmWiki's uploads, pub and css directories that need to be parameterizable and not hard-coded. Bigger problem is that the new Lightbox version uses a more recent Prototype release, and it will not work with the older ones. I'll try to find some time to upgrade all to the new version. --Petko December 19, 2009, at 03:59 AM

Remote images

Hi Petko, I'd love to use Mini (or its bigger brother) to display thumbnails of external images. Any chance that we might see that in the future or on how to quickly achieve this? --destotelhorus? October 28, 2009, at 05:17 PM

No, Mini is specifically designed to integrate with PmWiki uploads directories. WikiGallery and QDIG should be able to show thumbnails of pictures on the same server, even out of the PmWiki's uploads structure. I know no PHP online gallery creating thumbnails of pictures on remote servers. But Galleria may be what you want (JavaScript, which means that visitors download all images from the remote site and their browsers scale the pictures down, simulating thumbnails). --Petko October 29, 2009, at 06:58 PM

Would it be possible, instead of linking to remote directories, to link to a subfolder in the uploads directory? I.e., position the images in uploads/Main/randomfolder and then use Mini:randomfolder/someimage.jpg ? ~~ Thanks, Mike

Yes, you can have a sub-directory per-page instead of per-group, see the variable $UploadPrefixFmt in UploadsAdmin. --Petko December 28, 2009, at 03:48 AM

Mini with autogenerated page navigation

Petko, is it possible to create something like on the picture, because I have over 100 pictures and want to separate them on different pages. Of course, I can do it with range but then I must generate the linking pages manully. Thanks for your answer -- MatthiasGünther September 27, 2009, at 8:30 AM

Please look at How to slice a large Mini list into subpages. --Petko September 30, 2009, at 05:52 PM

It's working perfect, thanks a lot -- MatthiasGünther October 05 , 2009, at 12:05 AM

Now I have another question: Is it possible to add << and >> buttons in the perpages, so that the user can navigate to previous respectively next page like it is in ThumbList? --MatthiasGünther October 06 , 2009, at 12:07 AM

Yes, with a different link function like PaginateMini:10 . --Petko October 06, 2009, at 05:52 PM

Again, thousands thanks for your fast support, you are a real wiki-god for me :), hope I will be in the future as fast as you, if some are going to ask for additional features. --MatthiasGünther October 07 , 2009, at 00:45 AM

Displaying pictures attached to more than one page

Petko, If I want to list specific images for display, and I need or want to specify the group.page/filename.jpg for each one, the images do not display. Is this a problem with the code, or with my comprehension? Thanks! -- TeganDowling September 13, 2009, at 12:25 PM

You can display many pictures attached to another page with Mini:Group.Page/1.jpg,2.jpg -- I fixed the demo and added examples to the docs. To list pictures attached to more than one page, you need a Mini: set for each page, like Mini:Page1/1.jpg Mini:Page2/2.jpg. --Petko September 13, 2009, at 12:55 PM

Lightbox not working when Mini is used in SideBar

I'm having trouble using Mini with Lightbox in the SideBar. I want to display one or two thumbs in the SideBar, but when putting them in, Lightbox stops working, although the thumb shows up and they have the rel="lightbox[mini]" argument. In the source code of the page, it's obvious that lightbox isn't loaded at the beginning of the page. I'm having no trouble when using Mini and Lightbox on a normal page. Any idea on how to get this to work? Thanks. --JK? August 28, 2009, at 08:18 AM

I am not sure why this happens, I'll have to find some time to review it. In the meantime, you can add the following in config.php after the include_once('cookbook/mini.php') line:
$HTMLHeaderFmt['lightbox'] = sprintf($Mini['LbJS'], $Mini['LbUrl']);
Thanks. --Petko August 28, 2009, at 09:49 AM

Thanks for the quick reply, it does work now. I'm guessing this is injecting the lightbox css code at anytime. --JK? August 29, 2009, at 06:04 AM

The problem comes from the way PmWiki processes a skin template, see PITS:01139 for details. Yes, the command injects the Lightbox library in all pages. --Petko September 13, 2009, at 02:12 PM

Note: For Mini version 20110817 and newer, use this code instead:
MiniHeaderFmt();

Return to the gallery

When you click on a thumbnail, it opens the original image. Is there a function for clicking on the larger image to return to the gallery? - Ian MacGregor

No, the readers have to use their browsers' Back button. However, the recipe can be used with Lightbox JavaScript, and it offers better usability. Try it with $Mini['EnableLightbox']=1; [1] --Petko July 13, 2008, at 12:24 AM
Lightbox sounds interesting and may be worth allowing javascript. I'll give Mini+Lightbox a try. - Ian MacGregor

Links to galleries

IPTC captions

It is an exelent application, but it would be even better for me if the iptc caption field could be used. With this I could easily comment my pictures in Picassa, IrfanView; upload them as a batch and find those comments displayed when looking at the pictures online. Damien September 27, 2008, at 04:18 PM

See this recipe. --Petko September 27, 2008, at 05:33 PM

Random Thanks and Stuff

I have been looking for a solution like this for such a long time. Thank you for such a wonderful work! -- JLuk, October 27, 2008

Thanks for your kind words! --Petko November 23, 2008, at 07:35 PM

Lightbox is not working for me.

I have tried everything but Lightbox seems not to work with my pmwiki (i have the latest version). Maybe there are some bugs in the latest version of 2 december? I spent 2 hours trying to figure out whats wrong but i can't find anything. Maybe there is something wrong with the javascript because i can't see it in the page source code of my website.

Here is part of my configuration file:

 $Mini['EnableLightbox'] = 1;
 $Mini['LbUrl'] = "$FarmPubDirUrl/lb" ; 
 $Mini['LbMaxH'] = 800; $Mini['LbMaxW'] = 800;
 include_once("$FarmD/cookbook/mini.php");

Here is the part from mini.php:

 'EnableLightbox' => 1,
 'Px' => 150,'Quality' => 90,
 'CropXPos' => 0.5, 'CropYPos' => 0.5,
 'LbMaxH'=> 800,'LbMaxW'=> 800,

I followed the documentation and placed mini.php in the cookbook directory and the lb directory in my /pub directory. But Lightbox just doesn't work.

 -- miranon?, 3 december 2008
Hi. First, you should not edit the mini.php file. All settings could be done in config.php and they automatically override the internal variables. This is part of the PmWiki Philosophy #5 -- easier to upgrade to a newer version of Mini. (Set $Mini['Px']=150; in config.php.) Second, I feel the problem comes from your line $Mini['LbUrl'] = "$FarmPubDirUrl/lb" ; where the $FarmPubDirUrl variable may not yet exist; just remove the line. Other possible issue may be that you defined LbMaxH and LbMaxW, but your original pictures are larger than 800 px. If this doesn't help, is there a page I could look at? --Petko December 02, 2008, at 06:23 PM
Lightbox is now working. Thanks!
Hi Petko, everything is working now. I figured out that the reason was my template for pmwiki, i forgot to include the -><!--HTMLHeader-->. Now i have fixed it and everything is working fine. Thanks for your help and tips! Greetings, -- miranon, 3 december 2008

Troubleshooting tips for Lightbox

If Lightbox is not working usually the problems are:

  • Completely blank page:
    = missing PHP function, likely with IPTC, disable IPTC;
    check the server "error log" for messages
  • Thumbnails not created:
    • No links to originals created
      = uploads not found, enable uploads and/or check if the files are visible to PmWiki,
      ie. both Attach:yourpic.jpg and (:attachlist:) should show the pictures.
      Also: file extensions need to be lowercase, .jpg not .JPG
    • Links to originals created, thumbnails created but not shown
      = file permissions on the server directories
    • Links to originals created, thumbnails not shown and not created in the uploads directory
      = PHP Memory limit
  • Thumbnails created, Lightbox not working:
    = Skin needs <!--HTMLHeader--> or <!--HTMLFooter-->
    = $FarmPubDirUrl is incorrect
    = is the lightbox directory from mini.zip copied in pmwiki/pub?

(Tips from Petko on the mailing list on 2010-03-08.) ²

Uppercase extensions

Great extension, very useful and really easy to use.
I have one uncomprehensive behaver: if I use Mini:pic1.JPG,pic2.JPG every thing is fine but if I use Mini:pic* nothing is displayed. If I rename the pics to use ".jpg" and not ".JPG" the Mini:pic* is working.
Is there a parameter limiting the search in "*" case? February 21, 2009, at 07:15 AM

Sorry. Uppercase extensions,as well as filenames with spaces, are not supported, and will not be. It is written in the documentation. If the first markup works, it may be a bug and you shouldn't rely on it, as the bug will be fixed. (The only filenames that should be expected to work with Mini are those that can be displayed inline with Attach:picture.jpg.) --Petko February 21, 2009, at 08:02 AM
I am still using pmwiki-2.1.27 on a Windows Server (that I do not administrate) and their Attach:PicTure.JPG forks fine.
But if You tel me that it may be a bug and is not supported any more in the newer pmwiki versions I should inform my user to principally not use any Uppercase extensions any more. The problem is that often cameras use Uppercase extensions for the filenames and we use ftp-upload for photo galleries so that I can not prevent this based on the pmwiki upload mechanism. Georges Schutz? February 21, 2009, at 08:55 AM
Right, on Windows, filenames are case-insensitive, but on most servers they are not: pic.JPG and pic.jpg can be different files. PmWiki officially supports only lowercase extensions, and if you upload your files via the ?action=upload link, they are renamed to acceptable filenames (lowercase extensions). I am considering adding a variable that will automatically rename existing files with unsupported names, to correct ones. --Petko February 21, 2009, at 09:14 AM
Could be a solution.
Is there a possibility to scan for filename conformity in all side-specific uploads (in all upload directories)? I sow that their is a recipe RecentUploadsLog that I could perhaps use to regularly check the uploads. But does this only show files uploaded by ?action=upload or all files in the multiple upload directories? Georges Schutz? February 21, 2009, at 11:32 AM
As of version 20090321, Mini can autorename existing files to the right filenames, as if you uploaded them via the ?action=upload. --Petko March 21, 2009, at 06:17 PM

a.jpg to c.jpg

I'm running an architecture website (zapgun.pt) using PmWiki engine with a lot of your recipes & tips (Maxi, Mini, UnToggle...). We are grateful towards your work around here (I'm just looking for a beautiful postcard to send ;)
Concerning this Mini feature, since I've frequent images with a year_month_day name and, instead what's your suggestion, organized per directory, I'm wondering if there are any line that produce a Mini:1.jpg(to)6.jpg thumbnail (ex. Mini:2005_05_12-4.jpg(to)2005_11_16.jpg ). I've tried different combinations of your "lists usage" but I didn't get any code that reproduce this effect.
Since my website is constantly changing is difficult to address a definitive link to a Mini gallery usage. For now, if you wish, here you can look to directory that use both the Mini and UnToggle: http://zapgun.pt/wiki/index.php/Bellynavel
Thank you - Tomita, June 05, 2009

Hi. I'm not sure I completely understand what you try to achieve. In your example page, you can use Mini:2006_10_31*,2006_11_16*. For example, to display pictures from one day, you can have Mini:2006_10_31*, or for all pictures from April: Mini:2009_04*. If you use uploads per group, easiest is to have some common prefix or suffix (like a date, or the name of the subject) for all pictures that need to be in one gallery. --Petko June 08, 2009, at 04:41 PM

I didn't make myself clear: what I was asking was about some line that produces images From X To Y (using the abc dictionary index). For instance, I have 01.jpg 02.jpg 03.jpg (...) 50.jpg uploaded but I only want to display in thumbnails images from 05.jpg to 15.jpg; It was very useful, also, if we could use different combination of From>To like: Mini:05.jpg>15.jpg,18.jpg>28.jpg.
This is just because I've noticed that I have, in certain circumstances, to use a lot of -(minus) jpgs and a long list of jpgs to produce a list of the images that I want in thumbnails.
Thank you - Tomita, June 09, 2009

You can add a custom function which slices the Mini set. See Mini_Range. --Petko June 10, 2009, at 11:18 AM

Thanks, obrigado, merci & Много благодаря. This recipe will be very helpful to me. I didn't had time to test it properly, so, I will write my opinion about Mini Range in a few days.
Tomita June 11, 2009

Concerning the chapter "Title and text around the gallery" in Mini Cookbook: Is it possible to have different titles, texts or tooltips for each thumb/frame in the same gallery?
(eg.: Mini:1jpg”This is Picture 1”,2.jpg”This is number 2” etc.)
Because it is very odd to have a single gallery with different subjects without the possibility to have different tooltips (and usually, the picture names, with all the numbers and letters are not very nice to be the shown the name, as the title, for the picture) .

  • You can have Mini:1.jpg"Title 1" Mini:2.jpg"Title 2" Mini:3.jpg"Title 3" or, easier:
    Mini:1.jpg"Title 1" \
    Mini:2.jpg"Title 2" \
    Mini:3.jpg"Title 3"
    Note the backslash \ at the end of each line except the last one.

Concerning the Mini Range recipe: It would be nice to have a crossed features with the command lines available in the mother Mini.
(eg.: Mini_Range:image01.jpg..image04.jpg,*,image06.jpg,ex*,-image02.jpg etc.)
Since my understanding about PHP, HTML, CSS... is near zero I don't have any idea if the above questions are possible or easy to program.

  • This is the case now. You first have FIRST..LAST pictures, then any list, * or ex* or -ex*...

Other thing that I had noticed (but I'm sure that this one is about my inability to deal properly with a correct installation) is that in the local folder with different Group.php instead of the main config.php I can't deal with the Mini Range because of this error: Fatal error: Cannot redeclare umini_range() in /home/zapgun/public_html/wiki/local/Blog.php on line 20
Tomita June 15, 2009

  • If you place the function in config.php, you don't need to add it to any other Group.php file, Mini_Range: will work in all pages. --Petko June 15, 2009, at 01:06 PM

Print out a page with Mini images

Is it possible to have a "print view" for printing out all Mini images in one page? --cg? 2009-12-18

You can click on the "Print" action link somewhere in the page. Like here. --Petko November 19, 2009, at 03:50 PM

Not exactly what I need today -- time is going by since 2009 and requirements have changed. ;-) We have a bunch of screenshots and you can inspect them in detail by your Mini Cookbook. But people like to print this lets say 20 screenshots. Now I would like to say action print. But in difference to the normal page images should have a with of 100% on the page, also hidden images -- via comment -- they belong to this screenshot series should be displayed. --cg? 2011-02-16

You can display the large pictures when a visitor clicks on the "Print" action link. Add the following code to config.php. --Petko February 18, 2011, at 07:04 AM

if($action=='print') {
  $Mini['ImgFmt'] = '';
  $Mini['LinkFmt'] = '<img src="%2$s" border="0"/>';
}

Amazing how easy some things are if you know the "magic code" -- Thanks a lot! There are two remaining questions 1) How is it possible to show also the titles in the page with action=print 2) How can I display images that are hidden in the defaul view eg via comments:

Mini:test1.jpg"Titel Bild 1"
>>comment<<
Mini:test2.jpg"Titel Bild 2" Mini:test3.jpg"Titel Bild 3"
>><< 

--cg? 2011-03-18

This code instead of the previous one should print all pictures, including those in comment blocks, and will show the title below each image. --Petko June 11, 2011, at 03:47 PM

if($action=='print') {
  $Mini['ImgFmt'] = '%2$s';
  $Mini['LinkFmt'] = '<div><img src="%2$s" border="0"/><br/>%1$s</div>';
  $WikiStyle['comment']['display'] = 'block';
}

Use tooltip titles for entire list

Hello - first, thanks for the great work. This is exactly precisely what I've been looking for.

Now my question: I'd like to display a list of images in one lightbox gallery, and did this like:

Mini:m1.jpg,m2.jpg,m3.jpg

Now, I'd like to additionally provide tooltip titles - to be displayed within the lightbox presentation. I tried

Mini:m1.jpg"Description one",m2.jpg"Description two",m3.jpg"Description three"

but it doesn't work. Any ideas?

I tried the above suggested:

You can have Mini:1.jpg"Title 1" Mini:2.jpg"Title 2" Mini:3.jpg"Title 3"

but it results in the images not being displayed as a single gallery anymore (I'm using lightbox with parameter "2").

thank you again! Mike

You are correct, this splits the gallery in a number of Mini sets. If you require both individual descriptions and prev-next slideshow, you have to use Lightbox mode 1. --Petko December 28, 2009, at 03:56 AM

Detailed tooltip titles for individual files in a single "Mini set" are possible from version 20110811, use this format:

Mini:[=
file1.jpg"Title of file1"
file2.jpg"Title of file2"
file4.jpg
file3.jpg
file5.jpg"Title of file5"
=]

Petko August 11, 2011, at 02:37 AM


Mini and MakeUploadNamePatterns

The Pacific Bulb Society wiki has the first character of uploaded picture file names capitalised. When pmwiki 2.2.6 allowed modifications to uploaded file names, I added: '/^./e'=>'strtoupper("$0")' to $MakeUploadNamePatterns so that the first character would automatically be capitalised.

After a while we noticed that when a page display required a thumbnail to be created, the thumbnail was created but did not display - subsequent page displays working correctly. I've decided that this is because after creating the thumbnail, mini displays it via HandleDownload(), that function applies the MakeUploadNamePatterns to the thumbnail name, we end up with Th00---. I have fixed things by adding another file name mapping:

'/^Th00---/e'=>'"th00---"'

I suspect if I was better at regex I could sort things out with one expression.

The general point is that additions to MakeUploadNamePatterns either have to skip thumbnails or must have no effect on thumbnails, for example forcing extensions to lower case is OK because thumbnails already have lower case extensions. --David Pilling

Thanks for your report. You can use this search pattern to skip thumbnails:
$MakeUploadNamePatterns['/^(?!th\d+---)./e'] = 'strtoupper("$0")';
This should also work for advances thumbnail sets. --Petko March 14, 2010, at 06:41 PM

Good tip, using regex "negative lookaround".

There's a catch with $MakeUploadNamePatterns if you put the line above in your config file the default values will never be set up, they're only initialised if this array does not already exist when the function MakeUploadName() is called - in addition the user config file is executed before upload.php which means one can't do a dummy call to MakeUploadName() to initialise them. I have copied the defaults from the function definition of MakeUploadName() in scripts/upload.php to my config file. -- David Pilling

Indeed, in order to allow admins to remove or reorder the replacement patterns, the full array needs to be defined. I fixed the documentation at $MakeUploadNamePatterns. Thanks. --Petko March 17, 2010, at 07:46 AM --

More thumbnail sizes

Great script, looks very promising. Featureset is more than enough for my needs. Haven't integrated it into my page yet. I have a question upfront:

Is it somehow possible to create thumbsnails like with Thumbnails2? I'fd liek to have square areas (background maybe black, but tht's CSS stuff) where the thumbnail is resized to fit in this square. Currently (as I understood) it is only possible to fix the width or height of the thumbnail and the other dimension is calculated automatically. Something like setting a maximum dimension in height and width while keeping proportion and everything located within a square Box. (I hope you know what I mean). Maybe this can be realized by setting the crop to -1 or something like that. Klonk March 19, 2010, at 03:04 AM

Settign crop to "-1" is not a too bad idea. [some stuff deleted, see below]

I'm simply not sure how to realize squares with centered images. Maybe with CSS? Klonk

OK, some bit more changes are necessary (I deleted the above), I got it working like I wanted it to have: add after line 234:

  $h1=$h;
  $w1=$w;
  if(($cx==-1) and ($cy==-1)){ #reduce imagesize to defined maximum, but keep proportion
	if($w/$h > $W/$H) {
		$w=round($h*$W/$H); }
	else {
		$h=round($w*$H/$W); }
  }

and change a few lines later to:

  $tY = max(round(($h1-$h)/2), round(($h-$H)/2));
  $tX = max(round(($w1-$w)/2), round(($w-$W)/2));

Would be great if you could implement these changes into your code. Klonk March 20, 2010, at 02:16 AM

I'll try to find some time to think if it is really necessary for many users. At the moment, you can have your own MiniCreate function overriding the existing one with such a code in a local config.php file:
  function uMyMiniCreate($fpath,$mpath,$W,$H,$T,$idx) {
    # copy here the modified function MiniCreate() from mini.php
  }
  $Mini['CreateFunction'] = 'uMyMiniCreate'; # override the default one

Then, Mini will call your modified function instead of the default one when a thumbnail needs to be created. --Petko March 20, 2010, at 03:40 AM


Markup (:mini 150x150:) Does not work

Sorry to tell, but markup (:mini 150x150:) Does not work Klonk

The only problem that remains is the markup (:mini .... :) not working. Klonk March 20, 2010, at 02:16 AM

It works for me. :-) Note that this markup needs to be in the page where the thumbnails are attached, which may be not the page where the Mini: list is written. Also, if you change the sizes, you need to purge existing thumbnails to let the program recreate them. --Petko March 19, 2010, at 12:46 PM

Did I understand correctly?: Let's say I have a page Main/Test where I show the images with Mini:Photo./*.jpg. Then the (:mini ...:) markup has to be written in a page Photo/Photo. Is this correct? If yes, then that's the problem because I placed the (mini ... :) markup at the same page as Mini:Photo./*.jpg (which makes more sense IMHO). Klonk March 20, 2010, at 06:42 AM

Yes, to change the sizes of the thumbnails Mini:Photo./*.jpg you need to edit the page which opens when you type [[Photo.]] -- it could be Photo.Photo, Photo.HomePage or other, depending on your local configuration. No, the only logical page to store the settings and the thumbnails is the page where the pictures are attached. This makes sense if you have a gallery in that same page, and in 2 or more other pages -- you wouldn't want editing another page to change the page where the pictures are attached. The program needs to work in the most usual case, files attached to the page where they are displayed. --Petko March 20, 2010, at 11:21 AM

Ahh, I see, nevertheless thanks a lot Klonk March 21, 2010, at 07:29 AM


IPTC and/or EXIF in lightbox/captions

you already showed a possibility to show IPTC as caption. Is tehre also a way to show the IPTC in the bigger lightbox display? Maybe also together with some basic EXIF information, like ISO, F-stop, time? Klonk May 06, 2010, at 01:51 AM

Yes, it may be possible, if someone writes a function similar to the existing one with IPTC (I'm afraid it wouldn't be me, in the next 5-6 weeks). Just note that Lightbox is really designed to show one line of text below the picture. --Petko May 09, 2010, at 07:47 PM


Real filename in tooltip and comment on directories

I wanted a simple way to show all the images in the wiki group. Mini is absolutely fantastic for this, but unfortunately it doesn't give the whole filename with extension. I will probably just change the mini.php to make this happen and/or list by file types.

Also the advice on the page is to store images by page. But a much simpler way to create a gallery, is to create a new directory in the upload and just use Mini:NewDir./*

To display the full filenames, just redefine $Mini['FNameRPat'] to an empty array in config.php after including mini.php:
$Mini['FNameRPat'] = array();
I don't recommend the Mini:NewDir./* thing because users may come to various problems if someday they create a WikiGroup named "NewDir". --Petko October 21, 2010, at 09:21 AM

Thanks, I was just looking up the IPTC addon and realised this told me how to change this but you seem to have got there earlier. For reference, this still isn't a perfect solution for an "image gallery" because I don't think you can copy and paste the hover-over box - but at least you don't have to guess the filename suffix -- which is all the worse, when you have capitalisation: JPG vs jpg -- which reminds me, ...

Just note that you shouldn't ever need to edit mini.php -- almost everything can be configured from config.php. This way you will be able to upgrade to newer Mini versions without losing your settings. --Petko October 30, 2010, at 01:40 PM


Uppercase extensions .JPG

Bug report I think there is a bug that means you can't see the images if your server is case sensitive and e.g. you have filetypes which are capitals: .JPG vs .jpg. As I recall, when you mini a directory, you just get a long list of files to upload each named <something>.jpg, which the server can't find because the original was <SOMETHING>.JPG ... obviously the workaround is to rename all filetypes as lowercase, but when you've got windows which won't accept change in case of filetype (you have to rename it .JPG->.x then .x->.jpgwattsupdoc? October 28, 2010, at 03:39 AM

Please see Mini#notes. This is known and expected and comes from PmWiki and not from Mini. PmWiki doesn't work with uppercase extensions. Mini is expected to only work with pictures which can be shown both with Attach:pic.jpg and with (:attachlist:) in a PmWiki page. If you mass-upload many files with uppercase extensions, Mini:* can rename them automatically, see Mini#autorename. --Petko October 30, 2010, at 01:40 PM


Links in description

I can use bold text in description but using links seems not to work. Any tipps?

You can have links and bold text in the additional visible description after the vertical bar:
Mini:pic01.jpg"Tooltip with NO formatting" | '''Description''' [[with]] %red% formatting.
Mini is not designed to handle any formatting in the descrtiption (tooltip title in quotes), bold text or links. If some formatting passes through, I didn't notice and I advice against using it -- it produces invalid/non-standard HTML output which may potentialy break the entire page with some browsers. --Petko November 26, 2010, at 11:42 AM


Internet Explorer IE9, Lightbox

IE9 does not work with older versions of Lightbox, version 2.05 3/18/11 is required. It is straightforward to get 2.05 and patch it to work with mini.

in lightbox.css this is the correct format of these two lines:

#prevLink:hover, #prevLink:visited:hover { background: url(prev.gif) left 15% no-repeat; }
#nextLink:hover, #nextLink:visited:hover { background: url(next.gif) right 15% no-repeat; }

in lightbox.js this is the required code:

var LightboxDirUrl;
$A(document.getElementsByTagName("script")).findAll( function(s) {
  return (s.src && s.src.match(/lightbox\.js(\?.*)?$/))
}).each( function(s) { LightboxDirUrl = s.src.replace(/lightbox\.js$/,''); });

//
//  Configurationl
//
LightboxOptions = Object.extend({
    fileLoadingImage:        LightboxDirUrl + "loading.gif",
    fileBottomNavCloseImage: LightboxDirUrl + "close.gif",

The chunk of code before the comments is added and the two lines for the .gif files are changed. --David Pilling

The new version 20110522 includes a file lightbox-mini.js which should ease future Lightbox upgrades by simply replacing the old files with the new ones. --Petko May 22, 2011, at 12:14 PM


Mini in a lfloat

%lfloat%Mini:picture.jpg%% foo results in wrong HTML, %lfloat%Mini:picture.jpg %% foo (space character between jpg and %) works. Is this related to PmWiki or Mini or just my misunderstanding? OliverBetz 20110525

At the moment it is from Mini, the percent character is not forbidden in filenames. Maybe it should be? Is it a problem? --Petko May 26, 2011, at 01:40 AM

Sorry, my initial description was a bit terse. With %lfloat%mini:picture.jpg%% foo I get the following HTML:

<div><span class='lfloat'><img class="mini" src="/.../th00---picture.jpg.jpg" title="picture.jpg</span>" alt="picture.jpg" border="0" /> foo</div>

The </span> is part of the quoted title. I wouldn't mind if "%%" was in the title, but the closing </span> is missing in the HTML. OliverBetz 20110527

This should be fixed as of 20110527a. Actually, PmWiki doesn't support percent signs in filenames, so Mini shouldn't either. --Petko May 27, 2011, at 09:22 AM


Remove border attribute from img tag?

As far as I undsrstand, XHTML 1.0 Strict doesn't allow the border attribute in the img tag. Is adding

$Mini['ImgFmt'] = '<img class="mini" src="%1$s" title="%2$s" alt="%2$s" />';

to config.php the right way to fix this? OliverBetz 20110525

Yes. However, I wouldn't recommend using "XHTML Strict". PmWiki tries (hard) to produce (x)HTML that will validate as "Transitional" - it will most likely fail to validate as "Strict" especially if you use tables, forms and other complex markups. The "transitional" standard is still a standard, so in most cases it should be enough. Anyways, if you must use "Strict", you can, but you're on your own. :-) --Petko May 26, 2011, at 01:40 AM

There are only few places where PmWiki doesn't generate "Strict" compliant code. I started a collection at XHTML_Strict. Maybe mini should also avoid old elements. OliverBetz 20110531


Lightbox Hijacks all mouse buttons

Earlier versions of lightbox used only the left mouse button, the current version starts the larger version of the picture on any mouse button press (I have "only" three buttons to test).

IMO that's somewhat annoying, because it disables the RMB context menu or "open in new tab" assigned to MMB by default in Firefox.

I found a patch in the lightbox forum but Ican't rate whether it is a clean method.

OliverBetz 20110531

It is, but it still doesn't allow middle clicks. Here is what you can use around line 190 of lightbox.js version 2.05:

document.observe('click', (function(event){ // LINE 190 EXISTS
  if(event.isRightClick() || event.isMiddleClick()) return; // LINE INSERTED

A single line is inserted after the opening { brace of the function, and will prevent Lightbox on right or middle clicks. --Petko June 11, 2011, at 03:29 PM


Mini and Attachtable?

Eemeli's Cookbook:Attachtable is a great tool especially because it tells me whether files are in use or not.

To respect also Mini: and mini. markup, I tried a simple patch in attachtable.php line 180:

 /\\b(Attach|Mini|mini):([^\\s$UrlExcludeChars]*[^\\s.,?!$UrlExcludeChars])/e" )

and changed the reference number in line 184, but found that this doesn't cover the "thorough search" used by Attachtable if only few pages are to be searched.

Can I use mini with Attachtable "thorough search"? Mini doesn't use $LinkFunctions.

In the mean, I use "$AttachtableProperReferenceLookupMaxPages = 0;" to use always the simple search.

OliverBetz 20110608

I don't use newer versions of Attachtable that list references so I wouldn't know. But the LinkMini() function can be called with a $listonly argument, and in that case it will return a newline-separated list of filenames that are in use. I'm not sure how Attachtable should handle this. Note that some recipes like mini-range and mini-slice may return only some of the files that are actually in use. Petko June 11, 2011, at 03:29 PM


Tweak fade speed

How can I make the Ultralightbox fade effect faster or disable it completely? OliverBetz 20111019

From version 20120725 you can set the delay at line 5 of the file ultralightbox.js, the bit LB.F=500; where 500 is the number of milliseconds. Set it to 0 to disable it. --Petko July 24, 2012, at 05:56 PM


Hidden Slideshow with "Lightbox mode 2"

Can I have different slideshow sets on one page, each showing only one thumbnail?

http://tl.5ko.fr/M/Hidden doesn't work in this case because it links to all pictures of the page.

OliverBetz 20121204

Something like this http://tl.5ko.fr/M/Hidden2? --Petko December 04, 2012, at 07:54 AM

Yes, many thanks, Petko!

Talk page for the Mini recipe (users).