getImage: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Conversion script moved page GetImage to getImage: Converting page titles to lowercase)
No edit summary
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:
|name=getImage
|name=getImage
|version=1.3b48
|version=1.3b48
|description=Returns the [[asset id]] for the image of a [[Token]] or [[Image Token]] found on any map in the campaign.  
|description=Returns the [[Asset ID]] for the image of a [[Token]] or [[Image Token]] found on any map in the campaign.  


|usage=
|usage=
Line 11: Line 11:


'''Parameters'''
'''Parameters'''
{{param|name|Token name.}}  '''Note:''' Token ID cannot be used.
{{param|name|Token name.}}  '''Note:''' Token ID can also be used.
{{param|size|Image size.}}  Optional.  Specify the size of the image that is called out in the asset string returned.
{{param|size|Image size.}}  Optional.  Specify the size of the image that is called out in the asset string returned.


If identical token names appear on multiple maps, it may be difficult (or impossible) to select a specific token image using this function.
{{Note|Token IDs are unique, but Token Names can be duplicated. Using Token Name when more than one token has the same name can produce unexpected results.}}


|example=
|example=

Revision as of 01:08, 9 May 2024

getImage() Function

Introduced in version 1.3b48
Returns the Asset ID for the image of a Token or Image Token found on any map in the campaign.

Usage

getImage(name)
getImage(name, size)

Parameters

  • name - Token name. Note: Token ID can also be used.
  • size - Image size. Optional. Specify the size of the image that is called out in the asset string returned.


Token IDs are unique, but Token Names can be duplicated. Using Token Name when more than one token has the same name can produce unexpected results.

Example

To display the image from an image token called image:Map you can do the following:
<img src="[r: getImage('image:Map')]"></img>

Alternatively this can be used to retrieve a normal token:

<img src="[r: getImage('Dragon')]"></img>

To display the image in chat with a max dimension of 100:

<img src="[r: getImage('Hero',100)]"></img>

See Also

getTokenImage (which you can give the size as parameter)