Here’s a quick demo of two possible templates, both using the <<currentTiddler>>
's fields:
- all image paths given in the
images
field, one path per line
- all image paths found in any field with the
img
prefix
Image fields demo.tid (983 Bytes)
(screenshot only shows the preview for the first technique)
For this use-case, with text interspersed between the images, I’d probably recommend doing something like this:
Tiddler text
<$image source={{!!img1}} />
Tiddler text
<$image source={{!!img2}} />
With field content:
img1: tiddler_name
img2: tiddler2_name
This would let you use the filter I demo’d in technique #2, above, to get just the images from a particular tiddler:
[<currentTiddler>fields[]prefix[img]] :map[<..currentTiddler>get<currentTiddler>]
Or to get the contents of all the img...
fields on all your tiddlers:
[fields[]prefix[img]] :map:flat[all[tiddlers]!is[draft]get{!!title}] +[unique[]]
This should be more efficient than extracting just the image sources from amidst your other text.
But if you need to keep the image sources in the text field (as you have them in your sample code), try this, untested:
[{!!text}split[<$image source="]butfirst[]] :map[split["]first[]]
Or to get all the images from all your text fields:
[all[tiddlers]!is[draft]search:text[<$image source="]get[text]] :map:flat[split[<$image source="]butfirst[]] :map:flat[split["]first[]]
You can of course replace all[tiddlers]
with whatever subset of tiddlers you want to search. If you have a lot of tiddlers, this may be rather slow.