How to display an image from a data tiddler ?

39 views
Skip to first unread message

arm...@gmail.com

unread,
Jan 30, 2022, 5:16:56 AM1/30/22
to TiddlyWiki
Hello everyone,

I'm searching how to display an image whose name is a value in a tiddler data, but all my attempts do not succeed.
I'm probably not using the right syntax... or what I want to do is not possible?
Can you help me?

I use two tiddlers:

A data tiddler (BD-Test1) which contains:

Image: test.jpg
Fullimage: ./files/test.jpg
Value1: No
Value2 : Yes


A second tiddler (Defail-Test1) which contains:

<$tiddler tiddler={{{ [is[current]removeprefix[Detail]addprefix[BD]] }}} >

<!-- Below, neither use the 'Image' or 'Fullimage' value displays the image  -->

[img [./files/{{##Image}}]]

[img [{{##Fullimage}}]]

!!Print values :

<!-- The display of Values is  good  -->

*Value1:  {{##Value1}}
*Value2 :  {{##Value2}}
</$tiddler>

<!-- Below, the displaying of the image is correct (path of image is therefore good)  -->

[img [./files/test.jpg]]


In advance, thanks for your help.

Arnaud

Mark S.

unread,
Jan 30, 2022, 10:37:24 AM1/30/22
to TiddlyWiki
```

Unfortunately, you can't paste the image link wikitext together with the transclusion text that way.

What you can do is define a macro to do the pasting. If this were at the top of your tiddler:

\define image-there(name) [img [./files/$name$]]

(don't include the backticks)

then when you want the image you could invoke via the macrocall widget:

<$macrocall $name="image-there" name={{##Image}}/>

```


arm...@gmail.com

unread,
Jan 30, 2022, 10:45:34 AM1/30/22
to TiddlyWiki
Thank you very much Mark! Your solution is exactly what I need.
Reply all
Reply to author
Forward
0 new messages