aboutsummaryrefslogtreecommitdiff
path: root/doc/plugins/contrib/album/discussion.mdwn
blob: b7c9b009509f3e48e4f7ccd023a012e995c71332 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
## installation queries from brush

thanks for this plugin.  it might help me in my application, which is to provide album/galleries which can be edited (ie. new images added, taken away, etc.) through web interface.

> That's my goal eventually, too. Perhaps you can help to
> design/write this plugin? At the moment I'm mostly
> waiting for a design "sanity check" from [[Joey]],
> but any feedback you can provide on the design would
> also be helpful. --[[smcv]]

i have two challenges: firstly, for installation, i'm not sure what all the files are that need to be downloaded (because of my setup i can't easily pull the repo).  so far i have Ikiwiki/Plugins/album.pm; ikiwiki-album; and 4 files in templates/  any others?

> Those are all the added files; ikiwiki-album isn't strictly
> needed (IkiWiki itself doesn't use that code, but you can
> use it to turn a directory full of images into correct
> input for the album plugin).
>
> You probably also want the album plugin's expanded version of
> style.css (or put its extra rules in your local.css).
> Without that, your albums will be quite ugly.
>
> There aren't currently any other files modified by my branch.
> --[[smcv]]

secondly: barring the CGI interface for editing the album, which would be great, is there at least a way to use attachment plugin or any other to manually add images and then create viewers for them?

> Images are just attachments, and viewers are pages (any supported
> format, but .html will be fastest to render). Attach each image,
> then write a page for each image containing the
> \[[!albumimage]] directive (usually it will *only* contain that
> directive).
>
> The script ikiwiki-album can help you to do this in a git/svn/etc.
> tree; doing it over the web will be a lot of work (until I get
> the CGI interface written), but it should already be possible!
>
> The structure is something like this:
> 
> * album.mdwn (contains the \[[!album]] directive, and perhaps also
>   some \[[!albumsection]] directives)
> * album/a.jpg
> * album/a.html (contains the \[[!albumimage]] directive for a.jpg)
> * album/b.jpg
> * album/b.html (contains the \[[!albumimage]] directive for b.jpg)
>
> Have a look at ikiwiki-album to see how the directives are meant to
> work in practice.
>
> --[[smcv]]

>> In the current version of the branch, the viewer pages are
>> generated automatically if you didn't generate them yourself,
>> so `ikiwiki-album` is no longer needed. --[[smcv]]

i'm new to ikiwiki, apologies if this is dealt with elsewhere.  -brush

> This plugin is pretty ambitious, and is unfinished, so I'd recommend
> playing with  a normal IkiWiki installation for a bit, then trying
> out this plugin when you've mastered the basics of IkiWiki. --[[smcv]]

----

## design feedback from joeyh on an earlier version

Not entirely relevant any more.
[[!toggle id="old-design-feedback" text="show"]]
[[!toggleable id="old-design-feedback" text="""
[[!toggle id="old-design-feedback" text="hide"]]

You had wanted my feedback on the design of this. I have not looked at the
code or tried it yet, but here goes. --[[Joey]]	

* Needing to create the albumimage "viewer" pages for each photo
  seems like it will become a pain. Everyone will need to come up
  with their own automation for it, and then there's the question
  of how to automate it when uploading attachments. -J

> There's already a script (ikiwiki-album) to populate a git
> checkout with skeleton "viewer" pages; I was planning to make a
> specialized CGI interface for albums after getting feedback from
> you (since the requirements for that CGI interface change depending
> on the implementation). I agree that this is ugly, though. -s

>> Would you accept a version where the albumimage "viewer" pages
>> could be 0 bytes long, at least until metadata gets added?
>>
>> The more I think about the "binaries as first-class pages" approach,
>> the more subtle interactions I notice with other plugins. I
>> think I'm up to needing changes to editpage, comments, attachment
>> and recentchanges, plus adjustments to img and Render (to reduce
>> duplication when thumbnailing an image with a strange extension
>> while simultaneously changing the extension, and to hardlink/copy
>> an image with a strange extension to a differing target filename
>> with the normal extension, respectively). -s

>>> Now that we have `add_autofile` I can just create viewer pages
>>> whenever there's an image to view. The current version of the
>>> branch does that. -s

* With each viewer page having next/prev links, I can see how you
  were having the scalability issues with ikiwiki's data structures
  earlier! -J

> Yeah, I think they're a basic requirement from a UI point of view
> though (although they don't necessarily have to be full wikilinks).
> -s

>> I think that with the new dependency types system, the dependencies for
>> these can be presence dependencies, which will probably help with
>> avoiding rebuilds of a page if the next/prev page is changed.
>> (Unless you use img to make the thumbnails for those links, then it
>> would rebuild the thumbnails anyway. Have not looked at the code.) --[[Joey]]

>>> I do use img. -s

* And doesn't each viewer page really depend on every other page in the
  same albumsection? If a new page is added, the next/prev links
  may need to be updated, for example. If so, there will be much
  unnecessary rebuilding. -J

> albumsections are just a way to insert headings into the flow of
> photos, so they don't actually affect dependencies.
>
> One non-obvious constraint of ikiwiki's current design is that
> everything "off-page" necessary to build any page has to happen
> at scan time, which has caused a few strange design decisions,
> like the fact that each viewer controls what album it's in.
>
> It's difficult for the contents of the album to just be a
> pagespec, like for inline, because pagespecs can depend on
> metadata, which is gathered in arbitrary order at scan time;
> so the earliest you can safely apply a pagespec to the wiki
> contents to get a concrete list of pages is at rebuild time.
>
> (This stalled my attempt at a trail plugin, too.) -s

>> Not sure I understand why these need to look at pagespecs at scan time?
>> Also, note that it is fairly doable to detect if a pagespec uses such
>> metadata. Er, I mean, I have a cheezy hack in `add_depends` now that does
>> it to deal with a similar case. --[[Joey]] 

>>> I think I was misunderstanding how early you have to call `add_depends`?
>>> The critical thing I missed was that if you're scanning a page, you're
>>> going to rebuild it in a moment anyway, so it doesn't matter if you
>>> have no idea what it depends on until the rebuild phase. -s

* One thing I do like about having individual pages per image is
  that they can each have their own comments, etc. -J

> Yes; also, they can be wikilinked. I consider those to be
> UI requirements. -s

* Seems possibly backwards that the albumimage controls what album
  an image appears in. Two use cases -- 1: I may want to make a locked
  album, but then anyone who can write to any other page on the wiki can
  add an image to it. 2: I may want an image to appear in more than one
  album. Think tags. So it seems it would be better to have the album
  directive control what pages it includes (a la inline). -J

> I'm inclined to fix this by constraining images to be subpages of exactly
> one album: if they're subpages of 2+ nested albums then they're only
> considered to be in the deepest-nested one (i.e. longest URL), and if
> they're not in any album then that's a usage error. This would
> also make prev/next links sane. -s

>> The current version constrains images to be in at most one album,
>> choosing one arbitrarily (dependent on scan order) if albums are
>> nested. -s

> If you want to reference images from elsewhere in the wiki and display
> them as if in an album, then you can use an ordinary inline with
> the same template that the album would use, and I'll make sure the
> templates are set up so this works. -s

>> Still needs documenting, I've put it on the TODO list on the main
>> page. -s

> (Implementation detail: this means that an image X/Y/Z/W/V, where X and
> Y are albums, Z does not exist and W exists but is not an album,
> would have a content dependency on Y, a presence dependency on Z
> and a content dependency on W.)
>
> Perhaps I should just restrict to having the album images be direct
> subpages of the album, although that would mean breaking some URLs
> on the existing website I'm doing all this work for... -s

>> The current version of the branch doesn't have this restriction;
>> perhaps it's a worthwhile simplification, or perhaps it's too
>> restrictive? I fairly often use directory hierarchies like
>> `a_festival/saturday/foo.jpg` within an album, which makes
>> it very easy to write `albumsection` filters. -s

* Putting a few of the above thoughts together, my ideal album system
  seems to be one where I can just drop the images into a directory and
  have them appear in the album index, as well as each generate their own wiki
  page. Plus some way I can, later, edit metadata for captions,
  etc. (Real pity we can't just put arbitrary metadata into the images
  themselves.) This is almost pointing toward making the images first-class
  wiki page sources. Hey, it worked for po! :) But the metadata and editing
  problems probably don't really allow that. -J

> Putting a JPEG in the web form is not an option from my point of
> view :-) but perhaps there could just be a "web-editable" flag supplied
> by plugins, and things could be changed to respect it.

>> Replying to myself: would you accept patches to support
>> `hook(type => 'htmlize', editable => 0, ...)` in editpage? This would
>> essentially mean "this is an opaque binary: you can delete it
>> or rename it, and it might have its own special editing UI, but you
>> can never get it in a web form".
>>
>> On the other hand, that essentially means we need to reimplement
>> editpage in order to edit the sidecar files that contain the metadata.
>> Having already done one partial reimplementation of editpage (for
>> comments) I'm in no hurry to do another.
>>
>> I suppose another possibility would be to register hook
>> functions to be called by editpage when it loads and saves the
>> file. In this case, the loading hook would be to discard
>> the binary and use filter() instead, and the saving conversion
>> would be to write the edited content into the metadata sidecar
>> (creating it if necessary).
>>
>> I'd also need to make editpage (and also comments!) not allow the
>> creation of a file of type albumjpg, albumgif etc., which is something
>> I previously missed; and I'd need to make attachment able to
>> upload-and-rename.
>> -s

>>> I believe the current branch meets your requirements, by having
>>> first-class wiki pages spring into existence using `add_autofile`
>>> to be viewer pages for photos. -s

> In a way, what you really want for metadata is to have it in the album
> page, so you can batch-edit the whole lot by editing one file (this
> does mean that editing the album necessarily causes each of its viewers
> to be rebuilt, but in practice that happens anyway). -s

>> Replying to myself: in practice that *doesn't* happen anyway. Having
>> the metadata in the album page is somewhat harmful because it means
>> that changing the title of one image causes every viewer in the album
>> to be rebuilt, whereas if you have a metadata file per image, only
>> the album itself, plus the next and previous viewers, need
>> rebuilding. So, I think a file per image is the way to go.
>>
>> Ideally we'd have some way to "batch-edit" the metadata of all
>> images in an album at once, except that would make conflict
>> resolution much more complicated to deal with; maybe just
>> give up and scream about mid-air collisions in that case?
>> (That's apparently good enough for Bugzilla, but not really
>> for ikiwiki). -s

>>> This is now in the main page's TODO list; if/when I implement this,
>>> I intend to make it a specialized CGI interface. -s

>> Yes, [all metadata in one file] would make some sense.. It also allows putting one image in
>> two albums, with different caption etc. (Maybe for different audiences.)
>> --[[Joey]]

>>> Eek. No, that's not what I had in mind at all; the metadata ends up
>>> in the "viewer" page, so it's necessarily the same for all albums. -s

>> It would probably be possible to add a new dependency type, and thus
>> make ikiwiki smart about noticing whether the metadata has actually
>> changed, and only update those viewers where it has. But the dependency
>> type stuff is still very new, and not plugin friendly .. so only just
>> possible, --[[Joey]] 
"""]]

----

## alternative "special extension" design (conclusion: "don't")

'''I think the "special extension" design is a dead-end, but here's what
happened when I tried to work out how it would work. --[[smcv]]'''

[[!toggle id="special-extension-sketch" text="show"]]
[[!toggleable id="special-extension-sketch" text="""
[[!toggle id="special-extension-sketch" text="hide"]]

Suppose that each viewer is a JPEG-or-GIF-or-something, with extension
".albumimage". We have a gallery "memes" with three images, badger,
mushroom and snake.

> An alternative might be to use ".album.jpg", and ".album.gif"
> etc as the htmlize extensions. May need some fixes to ikiwiki to support
> that. --[[Joey]] 

>> foo.albumjpg (etc.) for images, and foo._albummeta (with
>> `keepextension => 1`) for sidecar metadata files, seems viable. -s

Files in git repo:

* index.mdwn
* memes.mdwn
* memes/badger.albumjpg (a renamed JPEG)
* memes/badger/comment_1._comment
* memes/badger/comment_2._comment
* memes/mushroom.albumgif (a renamed GIF)
* memes/mushroom._albummeta (sidecar file with metadata)
* memes/snake.albummov (a renamed video)

Files in web content:

* index.html
* memes/index.html
* memes/96x96-badger.jpg (from img)
* memes/96x96-mushroom.gif (from img)
* memes/96x96-snake.jpg (from img, hacked up to use totem-video-thumbnailer :-) )
* memes/badger/index.html (including comments)
* memes/badger.jpg
* memes/mushroom/index.html
* memes/mushroom.gif
* memes/snake/index.html
* memes/snake.mov

ispage("memes/badger") (etc.) must be true, to make the above rendering
happen, so albumimage needs to be a "page" extension.

To not confuse other plugins, album should probably have a filter() hook
that turns .albumimage files into HTML? That'd probably be a reasonable
way to get them rendered anyway.

> I guess that is needed to avoid preprocess, scan, etc trying to process
> the image, as well as eg, smiley trying to munge it in sanitize.
> --[[Joey]] 

>> As long as nothing has a filter() hook that assumes it's already
>> text... filters are run in arbitrary order. We seem to be OK so far
>> though.
>>
>> If this is the route I take, I propose to have the result of filter()
>> be the contents of the sidecar metadata file (empty string if none),
>> with the `\[[!albumimage]]` directive (which no longer requires
>> arguments) prepended if not already present. This would mean that
>> meta directives in the metadata file would work as normal, and it
>> would be possible to insert text both before and after the viewer
>> if desired. The result of filter() would also be a sensible starting
>> point for editing, and the result of editing could be diverted into
>> the metadata file. -s

do=edit&page=memes/badger needs to not put the JPG in a text box: somehow
divert or override the normal edit CGI by telling it that .albumimage
files are not editable in the usual way?

> Something I missed here is that editpage also needs to be told that
> creating new files of type albumjpg, albumgif etc. is not allowed
> either! -s

Every image needs to depend on, and link to, the next and previous images,
which is a bit tricky. In previous thinking about this I'd been applying
the overly strict constraint that the ordered sequence of pages in each
album must be known at scan time. However, that's not *necessarily* needed:
the album and each photo could collect an unordered superset of dependencies
at scan time, and at rebuild time that could be refined to be the exact set,
in order.

> Why do you need to collect this info at scan time? You can determine it
> at build time via `pagespec_match_list`, surely .. maybe with some
> memoization to avoid each image in an album building the same list.
> I sense that I may be missing a subtelty though. --[[Joey]] 

>> I think I was misunderstanding how early you have to call `add_depends`
>> as mentioned above. -s

Perhaps restricting to "the images in an album A must match A/*"
would be useful; then the unordered superset could just be "A/*". Your
"albums via tags" idea would be nice too though, particularly for feature
parity with e.g. Facebook: "photos of Joey" -> "tags/joey and albumimage()"
maybe?

If images are allowed to be considered to be part of more than one album,
then a pretty and usable UI becomes harder - "next/previous" expands into
"next photo in holidays/2009/germany / next photo in tagged/smcv / ..."
and it could get quite hard to navigate. Perhaps next/previous links could
be displayed only for the closest ancestor (in URL space) that is an
album, or something?

> Ugh, yeah, that is a problem. Perhaps wanting to support that was just
> too ambitious. --[[Joey]] 

>> I propose to restrict to having images be subpages of albums, as
>> described above. -s

Requiring renaming is awkward for non-technical Windows/Mac users, with both
platforms' defaults being to hide extensions; however, this could be
circumvented by adding some sort of hook in attachment to turn things into
a .albumimage at upload time, and declaring that using git/svn/... without
extensions visible is a "don't do that then" situation :-)

> Or extend `pagetype` so it can do the necessary matching without
> renaming. Maybe by allowing a subdirectory to be specified along
> with an extension. (Or allow specifying a full pagespec,
> but I hesitate to seriously suggest that.) --[[Joey]] 

>> I think that might be a terrifying idea for another day. If we can
>> mutate the extension during the `attach` upload, that'd be enough;
>> I don't think people who are skilled enough to use git/svn/...,
>> but not skilled enough to tell Explorer to show file extensions,
>> represent a major use case. -s

Ideally attachment could also be configured to upload into a specified
underlay, so that photos don't have to be in your source-code control
(you might want that, but I don't!).

> Replying to myself: perhaps best done as an orthogonal extension
> to attach? -s

> Yet another non-obvious thing this design would need to do is to find
> some way to have each change to memes/badger._albummeta show up as a
> change to memes/badger in `recentchanges`. -s

Things that would be nice, and are probably possible:

* make the "Edit page" link on viewers divert to album-specific CGI instead
  of just failing or not appearing (probably possible via pagetemplate)

* some way to deep-link to memes/badger.jpg with a wikilink, without knowing a
  priori that it's secretly a JPEG (probably harder than it looks - you'd
  have to make a directive for it and it's probably not worth it)
"""]]

----

## resolved bug reports

[[!toggle id="fixed-bugs" text="show"]]
[[!toggleable id="fixed-bugs" text="""
[[!toggle id="fixed-bugs" text="hide"]]

### bug: unable to vary thumbnail size

Hi smcv, great plugin. I am an ikiwiki newbie but so far I've had success using your plugin.
I've integrated the jquery masonry plugin into the albumitem template and it works great.
But is there a way to create thumnails of different sizes? I've passed thumnailsize option
and value to album directive and while it does create the new thumbnail sizes it doesn't use them,
The 96x96 thumbnails still appear on the page no matter what I do. - jaime

> Fixed in album5 branch, thanks to [[KathrynAndersen]]. --[[smcv]]

----

### failed installation

Hi, the plugin looks great, but I am probably too dumb to use it ;( here is what I did:
created page gal.mdwn with just \[\[!album\]\] directive (no arguments) and subdirectory gal/ with images in form img_1234.jpg

when I run ikiwiki, I get something completely wrong though:

generated gal/index.html page contains following code repeated for every image:

    <div class="album-viewer">
      <div id="album-img">
        <div class="album-finish">
          <a href="./"><span class="album-arrow">↑</span></a>
        </div>
      </div>
    </div>

So no links to any images, etc.

The pages for individual images are generated though, but also not correct. Trails section is perfect, but the main part is wrong:

    <div class="album-prev">
      <a><span class="album-arrow">â†<90></span></a><br />
      <div class="album-thumbnail">
        <span class="selflink">
          <img src="./96x96-img_2913.jpg" width="96" height="72" alt="img 2913" title="img 2913" class="img" /></span>
      </div>
    </div>

This really seems like this should be in the album page and not individul page. It is only thumbnail and not full image. Also the full image is not in the generated html tree at all!

I am using ikiwiki 3.20130518, and got the album sources from the links of [this page](http://ikiwiki.info/plugins/contrib/album/) (part manual installation)

Any hint about what do I do wrong?

Thanks Lukas

> This plugin is not really finished. I probably need to update it for
> current ikiwiki. I'll try to update it (and also update my demo
> and installation instructions) at some point. --[[smcv]]

>> I have to appologize, I accidentally copied the template wrongly and that caused all the issues ;(
>> So now after two days debugging and tracing, I just fixed that and it works. Well, at least a learnt
>> a lot about ikiwiki internal ;-)
>> Thanks for all the work you did on the plugin! --Lukas

----

### bug + patch: not all images shown on album page

Hi smcv, we spoke on irc the other day. Passed `show => "0"` on line 126 in album.pm to remove the limit on the thumbnails shown on the album page. Setting it on the album directive didn't work.

--kjs

> That sounds like a correct solution. I'll fix that in my branch when I work on
> this again. --[[smcv]]

>> Fixed in `album5` branch --s

----

### bug: thumbnailsize doesn't work

As mentioned above by Jaime setting the thumbnailsize doesn't catch either. Or rather if I git push after changing the album directive the generated thumbnails (the image files) are the correct size as set in the directive. The html however uses the default thumbnailsize as hardcoded in album.pm and has broken thumbnails as it links to a file with the default size in the filename.

> [[KathrynAndersen]] fixed this, see below. --[[smcv]]

>> Fixed in `album5` branch --s

Issuing `ikiwiki --rebuild` knocks the system into another gear where the thumbnails show up correctly but this is only due to the html being the same as above (linking to hardcoded thumbnailsize) but the generated thumbnail images are now matching the hardcoded size ignoring the thumbnailsize attribute on the album directive.

For me this behaviour is way beyond my skills to sort out (I'm no coder). The albumplugin ikiwiki combo is very attractive to me and the plugin i soo close to working!

--kjs

### suggested fix for thumbnail size bug

I've tracked down the "always showing the 96x96 thumbnails" bug!

The problem is in the pagetemplate function, which calls "thumbnail" to determine the name of the thumbnail image to use. As you know, the "img" method of generating thumbnails includes the size of the thumbnail as part of its name (to ensure that resizing thumbnails will create a new file of the correct size). The problem is... that in the pagetemplate function, the thumbnailsize is NOT passed in to the call to "thumbnail", so it always returns the default size, 96x96. Hence nothing that anyone can do will change the thumbnails to anything else. Oh, the different-sized thumbnail images ARE created, but they're never linked to.

Here's a context-diff of my fix:

<pre>
*** /home/kat/files/repos/ikiwiki_smcv/IkiWiki/Plugin/album.pm	2013-12-18 14:50:06.861623226 +1100
--- album.pm	2013-12-18 15:51:09.393582879 +1100
***************
*** 484,489 ****
--- 484,490 ----
  		my $viewer = $params{page};
  		my $album = $pagestate{$viewer}{album}{album};
  		my $image = $pagestate{$viewer}{album}{image};
+                 my $thumbnailsize = $pagestate{$album}{album}{thumbnailsize};
  
  		return unless defined $album;
  		return unless defined $image;
***************
*** 495,501 ****
  
  		if ($template->query(name => 'thumbnail')) {
  			$template->param(thumbnail =>
! 				thumbnail($viewer, $params{destpage}));
  		}
  		if (IkiWiki::isinlinableimage($image)
  			&& ($template->query(name => 'imagewidth') ||
--- 496,502 ----
  
  		if ($template->query(name => 'thumbnail')) {
  			$template->param(thumbnail =>
! 				thumbnail($viewer, $params{destpage}, $thumbnailsize));
  		}
  		if (IkiWiki::isinlinableimage($image)
  			&& ($template->query(name => 'imagewidth') ||
</pre>

-- [[KathrynAndersen]]

> I haven't tried this change, but it seems sane. I'll apply it
> when I next work on this plugin.
>
> (OOI: why not a unified diff? The VCS world seems to have
> settled on those as universal, and I find them easier to
> read.)
>
> --[[smcv]]

>> Fixed in `album5` --s

----

### bug: inability to show more than 10 items

I've found another bug. The album plugin doesn't allow one to have more than 10 items in an album section. This is because it uses "inline" to display album sections, and the default for inline is to show only 10 items. So it only shows 10 items.

What would be good is if the album directive could have a "show" parameter which is passed on to preprocess_inline, so that users could decide how many items to show (including ALL of them, if they give show=0).

-- [[KathrynAndersen]]

> My intention was that all items would always be shown, so I would always pass
> `show => 0` to `preprocess_inline` (as kjs suggested above), but that must have
> got lost somewhere. I'll apply it next time I work on this plugin.
>
> An optional `show` parameter would be a possible enhancement beyond that,
> although I don't know how useful it would be; if it isn't passed, the
> default should be 0 (unlimited). --[[smcv]]

>> Fixed in `album5` --s

----

### cbaines' commit to change default thumbnail size

Regarding commit `Change the default thumbnail size`: as far as I
understand it, `size => 96x96` is meant to set the image size to
be as large as possible given these constraints: width ≤ 96px,
height ≤ 96px, and the original aspect ratio is preserved. So I
would hope that 96x96 doesn't distort the thumbnails. What distortion
are you seeing, and which versions of Imagemagick and Perlmagick
are you using?

--[[smcv]]

> I rebuilt the examples using both your album4 and album5 branches, and I only
> see this in the album4 branch. So this is probably ok to ignore.
> --[[cbaines]]
>
>> OK, I'll assume that was a duplicate of an earlier patch, probably the
>> one from KathrynAndersen. --s

"""]]

----

## wishlist + patch: make clicking on the large image go to the next

I've changed the behavior of the "slideshow" to show the next image when clicking the large image as downloading a full resolution image is a rare use case in a gallery of this type imho. The large clicktarget means you are likely to unnecessarily download large files otherwise. I can't quite follow the template, album.pm flow so I can't figure out how to put a "download full resolution" link on the viewer page which would be my next step. To achieve the next link i added ` link => ($nextpage or $album),` around line 454 in `my $img`

--kjs

> That seems reasonable. I'll consider that when I work on this
> plugin again next. --[[smcv]]

----

## wishlist from kjs

My wishlist for the plugin would include:

- Reading exif info from the imagefile
- ~~Keeping the full resolution image files out of version control~~ Solved this by simply creating a underlay for the images. Works out of the box for my non cgi workflow.
- Being able to create new albums by tag or by manually picking images from other albums. Could be a simple comma separated list of viewer names, or even full urls, in the album directive.
- A counter showing **current image/total number of images in album**. This would mean that you know how many images you have left to click through before you have seen all images in an album. This gives you enought info to decide weather to click through or go back/leave.

--kjs

> I want the first two of those too, perhaps one day I'll get round to
> implementing them.
>
> For the third, you can get the same practical effect using an inline
> as documented in the main page. --[[smcv]]
>> The downside to current behaviour is that clicking an inlined thumbnail will take you to the original album context. Previous/Next image will not match the thumbnails in the inline but the thumbnails in the album. This is a bit confusing for users and prevents using the image in multiple contexts without duplicating the image. To achieve what I'm looking for there would have to be several AlbumViewer pages for a single image. --kjs
>>
>>> Hmm, OK. That breaks the "one picture : one page" mental model,
>>> unfortunately. The pictures themselves can't be first-class wiki pages (see
>>> lengthy design discussions with Joey above) because they aren't something
>>> that produces HTML, and don't have human-readable text source code.
>>> In the current (album5) design, the viewer pages that are automatically
>>> created to go alongside the pictures are basically stand-ins for the
>>> pictures, as far as metadata, wikilinks, tags and other "first-class
>>> wiki page" things are concerned. --s

>>>> I can see why it's important to keep these models simple and have figured out
>>>> that the viewer pages are stand-ins for the image. Just as a tought though. If 
>>>> this relationship was made more explicit ie. the viewer pages *are the content*
>>>> just initially generated from the image metadata with a link to the image. Then 
>>>> the mental model would stay intact and more in line with how html and the 
>>>> implementation works.
>>>>
>>>> One thing to point out is that last time I tried pages can be members of 
>>>> arbitrary numbers of trails/albums. You just get multiple rows of navigation, one
>>>> for each trail. This doesn't quite work as it's hard to know which one to click.
>>>>
>>>> --k

>>>>> Pages can be part of arbitrarily many trails, yes - that's a consequence of
>>>>> how trails are created. If you can think of a better way to present a page
>>>>> that's in more than one trail, I'd welcome ideas... I did originally have an
>>>>> implementation where only one trail would generate links, but when I tried
>>>>> it on some (rather artificial) overlapping trails, the result was more
>>>>> confusing. --s

>>> If there are to be viewer pages elsewhere in the wiki, I don't think
>>> inheriting the picture's metadata is desired. Suppose you have a
>>> picture of Alice and Bob in the album "holiday in Exampleton, 2010",
>>> and it is tagged people/alice, people/bob and places/exampleton; the
>>> other contexts it appears in might include "pictures of Alice" and
>>> "pictures near Exampleton". If you look at the tag page for
>>> places/exampleton, I doubt you want to see that photo listed three
>>> times - once is enough, there's only one actual photo after all. So
>>> I think the "main" viewer page should be the only one that has
>>> the taglinks for people/alice, people/bob, places/exampleton.
>>> --s

>>>> The problem exposed by the tag page issue is very tricky. As you'd
>>>> probably want the exif info, captions and titles to transfer. Just not 
>>>> necessarily the tags.
>>>> --k

>>> My next question is, should the viewer page representing that
>>> particular picture in its context of "pictures near Exampleton"
>>> (i.e. its "next" and "previous" links go to the next and
>>> previous picture near Exampleton, regardless of whether it was
>>> on an earlier or later visit) be a first-class wiki page
>>> at all?
>>> --s

>>> * Does it make any sense to comment on "this picture in this
>>>   context", if your wiki has comments, or should the only
>>>   place you can comment on it be its "main" viewer page?
>>> * Is there any need for it to be possible to make a wikilink
>>>   to that particular picture in that particular context,
>>>   or does it only need wikilinks "to the picture" (which,
>>>   as an implementation detail, really go to its "main" viewer
>>>   page)?
>>> * Can the picture in that particular context have tags
>>>   that are orthogonal to the tags its "main" viewer page has?
>>> * ... and so on for various wiki features
>>>
>>> It sound as though the answer might ideally be that this secondary
>>> viewer page doesn't need to be a first-class wiki page at all,
>>> only a HTML output... except that the trail plugin works in terms
>>> of next and previous first-class wiki pages, not next and
>>> previous HTML outputs, and the HTML-generation pipeline
>>> is really aimed towards real pages.
>>>
>>> Perhaps the secondary viewer page should end up looking
>>> something like this:
>>>
>>>     \[[!albumviewer original=holiday-in-exampleton-2010/img1234
>>>       comment="To edit picture metadata, edit the original page instead"]]
>>>
>>> and one of the side-effects of the albumviewer directive should be to
>>> replace [[plugins/comments]] with a link to the original? --s

>>>> One thing to consider is the built in difference between the original and 
>>>> the secondary inferred by the fact that the first is an `album` the second
>>>> an `inline` --k

>>>>> I had assumed that both the "original" album (the one where the picture
>>>>> is physically located), and any other places you wanted to display it,
>>>>> would be some other directive whose implementation includes a call to
>>>>> `preprocess_inline`. `inline` on its own is not enough to create
>>>>> viewer pages to display the pictures, regardless of whether you
>>>>> want them to be one-per-picture or many-per-picture, and I'm not
>>>>> going to wedge yet more functionality into that plugin :-)
>>>>>
>>>>> It might be a good idea for the thing that displays pictures not
>>>>> physically located below that point to be a different directive, yes.
>>>>> --s

>>>> ### Single viewer 
>>>> For my own usecase what you describe makes sense. I see the content of an inline object
>>>> (struggling a bit with what terms to user here) as a particular composition of
>>>> viewers. Perhaps comments should only be possible on the page with the inline rather 
>>>> than the secondary viewer pages as the inline page not the image viewer is 
>>>> the first-class page in this scenario? The inline page would also be the page you tag 
>>>> etc. to make it show up in various contexts such as the tag page.
>>>>
>>>> With the thinking outlined above I'd say that the secondary viewer should be a 
>>>> non editable clone of the original viewer without any source. Just html output with 
>>>> backlinks to the original page. This means that there are limitations to how these 
>>>> secondary viewers can be used as the title, caption etc might fit some contexts 
>>>> better than others. Personally this is fine as I see these inline based albums as 
>>>> compositions or views on existing content.
>>>> --k
>>>>
>>>>> This is basically what I thought at first, but I realised while
>>>>> writing my earlier comments that it would be necessary
>>>>> to hack up [[plugins/trail]] fairly seriously to make it produce
>>>>> a trail through things that are not first-class wiki pages, and
>>>>> I'm not sure how much it would be necessary to subvert the
>>>>> rendering pipeline to get the right parentlinks and so on. --s
>>>>
>>>> ###Multiple viewers alternative
>>>> The alternative is having a page say in `/story/album.mdwn` with the following directive
>>>> \[[!inline  pages="/01/IMGP6494 or /02/IMGP6601 or /04/IMGP6922" sort="title"  show="0" template="albumitem"]]
>>>> that creates new fully fledged editable viewers for each image in `/story/album/'
>>>> without tags being auto populated but backlinks to the original album viewer.
>>>> --k
>>>>
>>>>> It can't *only* be an inline, because an inline wouldn't generate the
>>>>> viewer pages, but I see what you mean. --s
>>>> 
>>>> This would make the viewers completely independent allowing for unique titles, captions and comments
>>>> depending on context. Very useful when creating powerpoint like slideshows where you might need 
>>>> different captions depending on the context. In your example wiki with photos from gigs this would allow 
>>>> a page with an album inline about stage lighting with a selections of images and captions that highlight
>>>> relevant things in the image as well as a separate inline album page, with some of the same images, 
>>>> about drumming styles and posture/grip of drummers.
>>>>
>>>> I started writing all this supporting your single page case but looking at it now from my limited
>>>> understanding of how ikiwiki works it seems the multiple viewers option is conceptually cleaner 
>>>> and more flexible. It relies on three things:

>>>> * A mental model where the viewer page is the content not the image
>>>> * That tags aren't automatically transferred from the original context. This doesn't seem that critical however.
>>>> * Backlinks to the other places the image is used.
>>>>
>>>> --[[kjs]]

I've added "--k" to some of your comments so other readers (possibly including
my future self) can keep track of our conversation, I hope you don't mind :-)
--s

----

## cbaines' CSS changes

Regarding the CSS changes: I'll try to have a look soon, work out
what actually changed (since you re-ordered the CSS, so it isn't
immediately obvious from the diff), and integrate some or all of your
changes. Since Joey shows no signs of wanting to merge it, and "out of tree"
installation is currently a pain, I might split out the CSS changes into a
separate `ikiwiki/album.css` so that the only thing that needs to be merged
into style.css (or into local.css) is an appropriate
`@import` rule.

It shouldn't be necessary to add the album stuff to each individual
theme's style.css unless you actually want an actiontabs album and
a blueview album to be styled differently, because the IkiWiki Makefile
concatenates them: for instance, `/usr/share/ikiwiki/themes/actiontabs/style.css`
is the output of `cat doc/style.css themes/actiontabs/style.css`. So adding it
to `doc/style.css` should be enough? --[[smcv]]

> I don't think this is the case? Or at least, looking at the generated
> stylesheet for the examples built using my branch, I would expect there to be
> two copies of the album rules in the stylesheet [1], but there does not
> appear to be. This could quite easily be a result of some mistake in my part
> in not isolating the build though. --[[cbaines]]
>
> 1: <http://cbaines.net/projects/ikiwiki/album/dest/basic-actiontabs/style.css>
>
>> I searched for `/* relevant to the index page */` and found it twice,
>> so I stand by what I said :-) --s