Re: implementing external image path in shiraz image-card macro?

Further to my post in the TW google group yesterday, now following up here.

@TW_Tones and @Alvaro posted the same syntax in their replies to me requesting help to enable external image path using macros ximg in image-card (apologies to both if i’ve misunderstood something):
<$macrocall $name=“image-card” img=<<ximg imagename.jpg>> width="" align:“left” pos=“top”/>

However this is not working either. The tiddler displays the raw code with no formatting by image-card although the image (not the filename imagename.jpg) does display after img= . So, ximg is working as expected but macrocall is not calling image-card. I think Shiraz must be installed correctly since the normal syntax works fine:
<<image-card “imagename.jpg” title:“Image tile” text:“Image text goes here” footer:“Image footer” align:“right” pos:“top”>>

I’m not sure if it matters but I’m running TiddlyDesktop 0.0.14 under Linux Mint 19.3 with TiddlyWiki 5.1.22 and Shiraz 2.4.0 (I haven’t tried viewing this tiddlywiki in a browser yet but I assume I would see the same behaviour as in TiddlyDesktop.)

I’d love to make this work, thanks for any suggestions

Robin

Hi Robin

  1. The Tobias ximg defines a global folder path for external images, see External Image Path
  2. The Shiraz card image is an image and content macro displays an image as a card with card title, content and footer. See (Shiraz 2.4.0 — create stylish contents in Tiddlywiki)

So based on your original question, you like to use card image with external images (on the web or server, …) and you like to have the main path stored in a variable!

There is no need to use ximg with image card! Shiraz is self sufficient to do the job!

Example i

<$vars path="https://images.freeimages.com/images/large-previews/">
<$macrocall $name=image-card 
img={{{[[1cb/close-squirrel-1381764.jpg]addprefix<path>] }}}
width="320px"
align="center"
title="A ~NiFree Close squirrel Stock Photo"
text="This is a sample image. This example shows how to use Card Image in Shiraz!"
footer="From: https://images.freeimages.com"/>
</$vars>

Example ii

How create a new macro with base path.

\define mycard(img:"", width:"", align:"", caption:"", title:"", text:"", footer:"", pos:"", alt:"")
<$vars path="https://images.freeimages.com/images/large-previews/">
<$macrocall $name=image-card 
img={{{[[$img$]addprefix<path>] }}}
width="$width$"
align="$align$"
title="$title$"
text="$text$"
footer="$footer$"/>
</$vars>
\end

To test the macro creates a new tiddler with below text

!! Sample i
<<mycard "56f/a-squirrel-next-door-1350862.jpg" title:"A ~NiFree Close squirrel Stock Photo" text:"This is a sample image. This example shows how to use Card Image in Shiraz!" width:360px>>

!! Sample ii
<<mycard img:"1cb/close-squirrel-1381764.jpg"
 title:"Free A squirrel next door Stock Photo" 
 text:"This is another image. This imahe is provided by St. Mattox"
 width:360px
 footer:"From: https://images.freeimages.com">>

You can also use path as macro (mycard here) input parameter!

1 Like

Hi Mohammad

thanks so much for this comprehensive response, I’m going to enjoy putting this to use! The fully worked examples are very useful indeed. best wishes and thanks to all, bye, Robin