Skip to content

New function createAsset - #4923

Merged
cwisniew merged 14 commits into
RPTools:developfrom
Jmr3366:j_develop_createAsset
Oct 16, 2024
Merged

New function createAsset#4923
cwisniew merged 14 commits into
RPTools:developfrom
Jmr3366:j_develop_createAsset

Conversation

@Jmr3366

@Jmr3366 Jmr3366 commented Sep 15, 2024

Copy link
Copy Markdown
Contributor

Description of the Change

New trusted macro function createAsset(name,imageData) that will return an asset:\\< asset ID > value on success.
Checks are made for data types and only webp,jpg,png are permitted data types.

Possible Drawbacks

  • createAsset can allow scriptable asset creation and if implemented improperly, could be campaign breaking.
    With great power comes great responsibility.

Release Notes

Examples:
[r: createAsset("Test", < base64 encoded image data >)]
[r: createAsset("Test", "https://website.com/image.webp")]
outputs
asset:\\< asset ID >

(I renamed my branch as I almost overwrote it)


This change is Reviewable

@cwisniew

cwisniew commented Oct 9, 2024

Copy link
Copy Markdown
Member

This needs to ensure the asset is valid before adding it to the campaign

@Jmr3366

Jmr3366 commented Oct 10, 2024

Copy link
Copy Markdown
Contributor Author

I do check file headers for the 3 file formats this function supports. If there are other checks I can do or add, I will try to comply with those.

Comment thread src/main/java/net/rptools/maptool/client/functions/TokenImage.java Outdated
@Jmr3366
Jmr3366 requested a review from cwisniew October 12, 2024 11:28
@cwisniew
cwisniew added this pull request to the merge queue Oct 16, 2024
Merged via the queue into RPTools:develop with commit 2cd1d38 Oct 16, 2024
@cwisniew cwisniew added the feature Adding functionality that adds value label Dec 6, 2024
@kwvanderlinde kwvanderlinde moved this to Merged in MapTool 1.16 Mar 15, 2025
@Jmr3366
Jmr3366 deleted the j_develop_createAsset branch July 16, 2025 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Adding functionality that adds value

Projects

No open projects
Status: Merged

Development

Successfully merging this pull request may close these issues.

Import Base64-encoded image data to Asset

3 participants