Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Changing src for dynamic images in character sheet

Hello, I don't think that there is any way to do that but today i spent my day to find a way to change the attribute src of an image in the sheet template when using it on a character. The basic idea was :  <img name="attr_character_avatar"> <!-- or --> <img src="@{character_avatar}"> For sure, and for security reason i think, only the attribute *value* can be binded by a character attribute|method. But even <img value="@{character_avatar}"> doesnt works. So i begun to change *character_avatar* by a new custom attribute *attr_Avatarurl* updated from an input text. And again in all those cases before, even in doing that, the image could not retrieve *attr_Avatarurl* to update itself. This may be for security reasons but i really think that be able to display the character avatar is a necessity. If any one has any idea feel free to answer me ^^ Thanks
1501007525
Finderski
Plus
Sheet Author
Compendium Curator
You can't add an image to the character sheet tab (the custom HTML/CSS with the attribute fields), but you can add an avatar (and a default token) on the Bio & Info tab of the overall Character Sheet.
Even the avatar added, character_avatar still returns nothing
1501224171
Jakob
Sheet Author
API Scripter
Makusu-sama said: Even the avatar added, character_avatar still returns nothing Why would it? character_avatar is not a thing. There is no pseudo-attribute that contains the avatar. 
1501237561

Edited 1501237792
Jakob said: Makusu-sama said: Even the avatar added, character_avatar still returns nothing Why would it? character_avatar is not a thing. There is no pseudo-attribute that contains the avatar.  When you do @{selected|character_avatar} in the chat of the game you get a line return and no error. @{selected|character_img} for example returns an error saying that the attribute character_img does not exists. I thought maybe i was doing something wrong so. Edit: This was fixed. Btw this could be cool to have access in readonly to the character_avatar, dunno if it's possible
1501263309
Zargon
Sheet Author
Well, I was poking around last night and found a few answers for you: Roll20's code specifically strips out attempts at making dynamic images by referencing an attribute as the image source.  So ultimately this is not possible On a Character Sheet Attribute References are only handled in <input> tags. Technically speaking you could use the API to copy the URL of the Token Avatar into an attribute.
Zargon said: Well, I was poking around last night and found a few answers for you: Roll20's code specifically strips out attempts at making dynamic images by referencing an attribute as the image source.  So ultimately this is not possible On a Character Sheet Attribute References are only handled in <input> tags. Technically speaking you could use the API to copy the URL of the Token Avatar into an attribute. Thanks for the answer, i don't think you can manipulate the DOM from "text/worker" js environnement. It could be awesome if there is a way to ^^