Using range to add multiple images

Hi everyone,

I sometimes scan pages from books and include them in my wiki.

I end up with a tiddler like below

[img[canonical/Breathing/IMG_4637.PNG]]

[img[canonical/Breathing/IMG_4638.PNG]]

[img[canonical/Breathing/IMG_4639.PNG]]

[img[canonical/Breathing/IMG_4640.PNG]]

I can’t figure out how to use https://tiddlywiki.com/#range%20Operator To add multiple images at once.

Are there any examples I can look up? I’ve tried asking ChatGPT but nothing would work from its suggestions.

Thank you.

You haven’t provided quite enough information, and I’m not quite sure what to ask.

Here’s some sample code for discussion I hope will help pinpoint what you are looking for.

Nothing fancy here, just using an old-school macro approach:

\define imglink( pUrl pBaseName rs re)
<$list variable=linky filter="[range[$rs$],[$re$]]">
<$image source={{{ [[$pUrl$]] [[$pBaseName$]search-replace[%],<linky>] +[join[]] }}}/>
 //(<$text text={{{ [[$pUrl$]] [[$pBaseName$]search-replace[%],<linky>] +[join[]] }}}/> )//<br>
</$list>
\end

<<imglink pUrl:canonical/Breathing/ pBaseName:IMG_%.PNG rs:4637 re:4640>>

image

1 Like

@Cristi_Marian

I have done something similar, a wiki with lots of images but in my case mostly one per tiddler. However, the idea is the same with multiple images per tiddler.

I store my images in an external folder and all files have a name like CS121.jpg, where the 121 is just an increasing serial number stored in $:TLS tiddler and incremented after each successful add.

Then I have a button on a special tiddler that reads the next serial number and creates two tiddlers, one titled CSserialnumber that contains the canonical link to the image file and a second given a unique title that contains the transclusion to the first.

It would be a simple procedure to call the create code between two serial numbers.

Have a look at Central Street Archive and have a browse at the
$:/TLS/Actions/Add New Item tiddler. Here I add two images to the same tiddler.

bobj

Many thanks for the macro

I will try to convert to a procedure as advices here https://tiddlywiki.com/#Macros

Apologies, I don’t use procedures.

I think you’ll find it easier to communicate with folk by converting that code of mine from macro to procedure, so that’s a great idea.

Regarding finding a solution to your needs: best wishes, rock’n roll !

@Cristi_Marian … Once you converted it on your own, here is 1 possible solution.

SPOILER - Show code using a procedure
\procedure imglink( pUrl pBaseName rs re)
<$list variable=linky filter="[range<rs>,<re>]">
<$image source={{{ [<pUrl>] [<pBaseName>search-replace[%],<linky>] +[join[]] }}}/>
//(<$text text={{{ [<pUrl>] [<pBaseName>search-replace[%],<linky>] +[join[]] }}}/> )//<br>
</$list>
\end

<<imglink pUrl:canonical/Breathing/ pBaseName:IMG_%.PNG rs:4637 re:4640>>