Giving an attribute to an image coming from an object

Hello!

I am using Twine 2.6.2.0 and Sugarcube 2.36.1.

I am trying to adjust the size of an image, the source of which is the property of an object. Here is the the object:

<<set setup.top ={
	plainTshirt: {name: "plain white T-shirt", type: "man", price: 15, qty: 1, img: "[img[img/clothes/plainTshirt.png]]" },
/*some other clothes here*/ 
}>>

And here is the table where I call that image:

<tr><td>$PCtop.name<br>$PCtop.img</td><td>$PCbra.name<br>image</td><td>$PCneck.name<br>image</td></tr> 

Calling the image as such works, but if I try to add an attribute I just get :page_facing_up: or an error.
I tried like this <img src="$PCtop.img" height="170"> and i also tried to write it within the object img: "<img src="img/clothes/plainTshirt" height="170">" to no avail.

If anyone knows how to get that working, I would be truly grateful :blush:

You might want to look at the evaluation directive in the Sugarcube docs. If $PCtop.img is simply the url of your image, e.g. "img/clothes/plainTshirt.png", you can use this:

<img @src="$PCtop.img" height="170">
1 Like

That makes perfect sense, I did not use it properly yesterday. I was leaving the markup [[]] in the object :sweat_smile: It is now working as it should. Thank you for your help!