I’d like to show an external (local) picture inside a tiddler via ViewTemplate.
The picture name is to be taken from the tiddler name automatically when the tiddler is displayed. So if the tiddler is called “piccone” it should show the picture of the same name “piccone.png” stored in a directory (/itadeu/piccone.png) The file path works when inserted manually.
I did this tagged with $:/tags/ViewTemplate:
<$list filter="[is[current]tag[sostantivi]]">
<$set name="imgTitle" value=<<currentTiddler>>>
<$set name="imgSrc" value="/itadeu/{{!!title}}.png">
<p>debug path: <<imgSrc>></p>
<img src=<<imgSrc>> width="100" alt=<<imgTitle>> />
</$set>
</$set>
</$list>
But it does not work. I get the correct file path to the picture like this:
debug path: /itadeu/picture.png
And then the broken image link (icon) with the correct caption (“piccone”).
It seems like I can’t get the correct syntax for the src=“…” from the set/variables. What am I doing wrong here? How to read the filename correctly into the img src line?