1 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.
3 > That's my goal eventually, too. Perhaps you can help to
4 > design/write this plugin? At the moment I'm mostly
5 > waiting for a design "sanity check" from [[Joey]],
6 > but any feedback you can provide on the design would
7 > also be helpful. --[[smcv]]
9 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?
11 > Those are all the added files; ikiwiki-album isn't strictly
12 > needed (IkiWiki itself doesn't use that code, but you can
13 > use it to turn a directory full of images into correct
14 > input for the album plugin).
16 > You probably also want the album plugin's expanded version of
17 > style.css (or put its extra rules in your local.css).
18 > Without that, your albums will be quite ugly.
20 > There aren't currently any other files modified by my branch.
23 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?
25 > Images are just attachments, and viewers are pages (any supported
26 > format, but .html will be fastest to render). Attach each image,
27 > then write a page for each image containing the
28 > \[[!albumimage]] directive (usually it will *only* contain that
31 > The script ikiwiki-album can help you to do this in a git/svn/etc.
32 > tree; doing it over the web will be a lot of work (until I get
33 > the CGI interface written), but it should already be possible!
35 > The structure is something like this:
37 > * album.mdwn (contains the \[[!album]] directive, and perhaps also
38 > some \[[!albumsection]] directives)
40 > * album/a.html (contains the \[[!albumimage]] directive for a.jpg)
42 > * album/b.html (contains the \[[!albumimage]] directive for b.jpg)
44 > Have a look at ikiwiki-album to see how the directives are meant to
49 i'm new to ikiwiki, apologies if this is dealt with elsewhere. -brush
51 > This plugin is pretty ambitious, and is unfinished, so I'd recommend
52 > playing with a normal IkiWiki installation for a bit, then trying
53 > out this plugin when you've mastered the basics of IkiWiki. --[[smcv]]
57 You had wanted my feedback on the design of this. I have not looked at the
58 code or tried it yet, but here goes. --[[Joey]]
60 * Needing to create the albumimage "viewer" pages for each photo
61 seems like it will become a pain. Everyone will need to come up
62 with their own automation for it, and then there's the question
63 of how to automate it when uploading attachments.
65 > There's already a script (ikiwiki-album) to populate a git
66 > checkout with skeleton "viewer" pages; I was planning to make a
67 > specialized CGI interface for albums after getting feedback from
68 > you (since the requirements for that CGI interface change depending
69 > on the implementation). I agree that this is ugly, though. -s
71 >> Would you accept a version where the albumimage "viewer" pages
72 >> could be 0 bytes long, at least until metadata gets added? -s
74 * With each viewer page having next/prev links, I can see how you
75 were having the scalability issues with ikiwiki's data structures
78 > Yeah, I think they're a basic requirement from a UI point of view
79 > though (although they don't necessarily have to be full wikilinks).
82 >> I think that with the new dependency types system, the dependencies for
83 >> these can be presence dependencies, which will probably help with
84 >> avoiding rebuilds of a page if the next/prev page is changed.
85 >> (Unless you use img to make the thumbnails for those links, then it
86 >> would rebuild the thumbnails anyway. Have not looked at the code.) --[[Joey]]
88 * And doesn't each viewer page really depend on every other page in the
89 same albumsection? If a new page is added, the next/prev links
90 may need to be updated, for example. If so, there will be much
91 unnecessary rebuilding.
93 > albumsections are just a way to insert headings into the flow of
94 > photos, so they don't actually affect dependencies.
96 > One non-obvious constraint of ikiwiki's current design is that
97 > everything "off-page" necessary to build any page has to happen
98 > at scan time, which has caused a few strange design decisions,
99 > like the fact that each viewer controls what album it's in.
101 > It's difficult for the contents of the album to just be a
102 > pagespec, like for inline, because pagespecs can depend on
103 > metadata, which is gathered in arbitrary order at scan time;
104 > so the earliest you can safely apply a pagespec to the wiki
105 > contents to get a concrete list of pages is at rebuild time.
107 > (This stalled my attempt at a trail plugin, too.) -s
109 >> Not sure I understand why these need to look at pagespecs at scan time?
110 >> Also, note that it is fairly doable to detect if a pagespec uses such
111 >> metadata. Er, I mean, I have a cheezy hack in `add_depends` now that does
112 >> it to deal with a similar case. --[[Joey]]
114 >>> I think I was misunderstanding how early you have to call `add_depends`?
115 >>> The critical thing I missed was that if you're scanning a page, you're
116 >>> going to rebuild it in a moment anyway, so it doesn't matter if you
117 >>> have no idea what it depends on until the rebuild phase. -s
119 * One thing I do like about having individual pages per image is
120 that they can each have their own comments, etc.
122 > Yes; also, they can be wikilinked. I consider those to be
123 > UI requirements. -s
125 * Seems possibly backwards that the albumimage controls what album
126 an image appears in. Two use cases -- 1: I may want to make a locked
127 album, but then anyone who can write to any other page on the wiki can
128 add an image to it. 2: I may want an image to appear in more than one
129 album. Think tags. So it seems it would be better to have the album
130 directive control what pages it includes (a la inline).
132 > I'm inclined to fix this by constraining images to be subpages of exactly
133 > one album: if they're subpages of 2+ nested albums then they're only
134 > considered to be in the deepest-nested one (i.e. longest URL), and if
135 > they're not in any album then that's a usage error. This would
136 > also make prev/next links sane.
138 > If you want to reference images from elsewhere in the wiki and display
139 > them as if in an album, then you can use an ordinary inline with
140 > the same template that the album would use, and I'll make sure the
141 > templates are set up so this works.
143 > (Implementation detail: this means that an image X/Y/Z/W/V, where X and
144 > Y are albums, Z does not exist and W exists but is not an album,
145 > would have a content dependency on Y, a presence dependency on Z
146 > and a content dependency on W.)
148 > Perhaps I should just restrict to having the album images be direct
149 > subpages of the album, although that would mean breaking some URLs
150 > on the existing website I'm doing all this work for... -s
152 * Putting a few of the above thoughts together, my ideal album system
153 seems to be one where I can just drop the images into a directory and
154 have them appear in the album index, as well as each generate their own wiki
155 page. Plus some way I can, later, edit metadata for captions,
156 etc. (Real pity we can't just put arbitrary metadata into the images
157 themselves.) This is almost pointing toward making the images first-class
158 wiki page sources. Hey, it worked for po! :) But the metadata and editing
159 problems probably don't really allow that.
161 > Putting a JPEG in the web form is not an option from my point of
162 > view :-) but perhaps there could just be a "web-editable" flag supplied
163 > by plugins, and things could be changed to respect it.
165 >> Replying to myself: would you accept patches to support
166 >> `hook(type => 'htmlize', editable => 0, ...)` in editpage? This would
167 >> essentially mean "this is an opaque binary: you can delete it
168 >> or rename it, and it might have its own special editing UI, but you
169 >> can never get it in a web form".
171 >> On the other hand, that essentially means we need to reimplement
172 >> editpage in order to edit the sidecar files that contain the metadata.
173 >> Having already done one partial reimplementation of editpage (for
174 >> comments) I'm in no hurry to do another.
176 >> I suppose another possibility would be to register hook
177 >> functions to be called by editpage when it loads and saves the
178 >> file. In this case, the loading hook would be to discard
179 >> the binary and use filter() instead, and the saving conversion
180 >> would be to write the edited content into the metadata sidecar
181 >> (creating it if necessary).
183 >> I'd also need to make editpage (and also comments!) not allow the
184 >> creation of a file of type albumjpg, albumgif etc., which is something
185 >> I previously missed; and I'd need to make attachment able to
186 >> upload-and-rename.
189 > In a way, what you really want for metadata is to have it in the album
190 > page, so you can batch-edit the whole lot by editing one file (this
191 > does mean that editing the album necessarily causes each of its viewers
192 > to be rebuilt, but in practice that happens anyway). -s
194 >> Replying to myself: in practice that *doesn't* happen anyway. Having
195 >> the metadata in the album page is somewhat harmful because it means
196 >> that changing the title of one image causes every viewer in the album
197 >> to be rebuilt, whereas if you have a metadata file per image, only
198 >> the album itself, plus the next and previous viewers, need
199 >> rebuilding. So, I think a file per image is the way to go.
201 >> Ideally we'd have some way to "batch-edit" the metadata of all
202 >> images in an album at once, except that would make conflict
203 >> resolution much more complicated to deal with; maybe just
204 >> give up and scream about mid-air collisions in that case?
205 >> (That's apparently good enough for Bugzilla, but not really
208 >> Yes, [all metadata in one file] would make some sense.. It also allows putting one image in
209 >> two albums, with different caption etc. (Maybe for different audiences.)
212 >>> Eek. No, that's not what I had in mind at all; the metadata ends up
213 >>> in the "viewer" page, so it's necessarily the same for all albums. -s
215 >> It would probably be possible to add a new dependency type, and thus
216 >> make ikiwiki smart about noticing whether the metadata has actually
217 >> changed, and only update those viewers where it has. But the dependency
218 >> type stuff is still very new, and not plugin friendly .. so only just
219 >> possible, --[[Joey]]
223 Trying to use the "special extension" design:
225 Suppose that each viewer is a JPEG-or-GIF-or-something, with extension
226 ".albumimage". We have a gallery "memes" with three images, badger,
229 > An alternative might be to use ".album.jpg", and ".album.gif"
230 > etc as the htmlize extensions. May need some fixes to ikiwiki to support
233 >> foo.albumjpg (etc.) for images, and foo._albummeta (with
234 >> `keepextension => 1`) for sidecar metadata files, seems viable. -s
240 * memes/badger.albumjpg (a renamed JPEG)
241 * memes/badger/comment_1._comment
242 * memes/badger/comment_2._comment
243 * memes/mushroom.albumgif (a renamed GIF)
244 * memes/mushroom._albummeta (sidecar file with metadata)
245 * memes/snake.albummov (a renamed video)
247 Files in web content:
251 * memes/96x96-badger.jpg (from img)
252 * memes/96x96-mushroom.gif (from img)
253 * memes/96x96-snake.jpg (from img, hacked up to use totem-video-thumbnailer :-) )
254 * memes/badger/index.html (including comments)
256 * memes/mushroom/index.html
258 * memes/snake/index.html
261 ispage("memes/badger") (etc.) must be true, to make the above rendering
262 happen, so albumimage needs to be a "page" extension.
264 To not confuse other plugins, album should probably have a filter() hook
265 that turns .albumimage files into HTML? That'd probably be a reasonable
266 way to get them rendered anyway.
268 > I guess that is needed to avoid preprocess, scan, etc trying to process
269 > the image, as well as eg, smiley trying to munge it in sanitize.
272 >> As long as nothing has a filter() hook that assumes it's already
273 >> text... filters are run in arbitrary order. We seem to be OK so far
276 >> If this is the route I take, I propose to have the result of filter()
277 >> be the contents of the sidecar metadata file (empty string if none),
278 >> with the `\[[!albumimage]]` directive (which no longer requires
279 >> arguments) prepended if not already present. This would mean that
280 >> meta directives in the metadata file would work as normal, and it
281 >> would be possible to insert text both before and after the viewer
282 >> if desired. The result of filter() would also be a sensible starting
283 >> point for editing, and the result of editing could be diverted into
284 >> the metadata file. -s
286 do=edit&page=memes/badger needs to not put the JPG in a text box: somehow
287 divert or override the normal edit CGI by telling it that .albumimage
288 files are not editable in the usual way?
290 > Something I missed here is that editpage also needs to be told that
291 > creating new files of type albumjpg, albumgif etc. is not allowed
294 Every image needs to depend on, and link to, the next and previous images,
295 which is a bit tricky. In previous thinking about this I'd been applying
296 the overly strict constraint that the ordered sequence of pages in each
297 album must be known at scan time. However, that's not *necessarily* needed:
298 the album and each photo could collect an unordered superset of dependencies
299 at scan time, and at rebuild time that could be refined to be the exact set,
302 > Why do you need to collect this info at scan time? You can determine it
303 > at build time via `pagespec_match_list`, surely .. maybe with some
304 > memoization to avoid each image in an album building the same list.
305 > I sense that I may be missing a subtelty though. --[[Joey]]
307 >> I think I was misunderstanding how early you have to call `add_depends`
308 >> as mentioned above. -s
310 Perhaps restricting to "the images in an album A must match A/*"
311 would be useful; then the unordered superset could just be "A/*". Your
312 "albums via tags" idea would be nice too though, particularly for feature
313 parity with e.g. Facebook: "photos of Joey" -> "tags/joey and albumimage()"
316 If images are allowed to be considered to be part of more than one album,
317 then a pretty and usable UI becomes harder - "next/previous" expands into
318 "next photo in holidays/2009/germany / next photo in tagged/smcv / ..."
319 and it could get quite hard to navigate. Perhaps next/previous links could
320 be displayed only for the closest ancestor (in URL space) that is an
323 > Ugh, yeah, that is a problem. Perhaps wanting to support that was just
324 > too ambitious. --[[Joey]]
326 >> I propose to restrict to having images be subpages of albums, as
327 >> described above. -s
329 Requiring renaming is awkward for non-technical Windows/Mac users, with both
330 platforms' defaults being to hide extensions; however, this could be
331 circumvented by adding some sort of hook in attachment to turn things into
332 a .albumimage at upload time, and declaring that using git/svn/... without
333 extensions visible is a "don't do that then" situation :-)
335 > Or extend `pagetype` so it can do the necessary matching without
336 > renaming. Maybe by allowing a subdirectory to be specified along
337 > with an extension. (Or allow specifying a full pagespec,
338 > but I hesitate to seriously suggest that.) --[[Joey]]
340 >> I think that might be a terrifying idea for another day. If we can
341 >> mutate the extension during the `attach` upload, that'd be enough;
342 >> I don't think people who are skilled enough to use git/svn/...,
343 >> but not skilled enough to tell Explorer to show file extensions,
344 >> represent a major use case. -s
346 Ideally attachment could also be configured to upload into a specified
347 underlay, so that photos don't have to be in your source-code control
348 (you might want that, but I don't!).
350 > Replying to myself: perhaps best done as an orthogonal extension
353 Things that would be nice, and are probably possible:
355 * make the "Edit page" link on viewers divert to album-specific CGI instead
356 of just failing or not appearing (probably possible via pagetemplate)
358 * some way to deep-link to memes/badger.jpg with a wikilink, without knowing a
359 priori that it's secretly a JPEG (probably harder than it looks - you'd
360 have to make a directive for it and it's probably not worth it)