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

How to get html address of image in library?

1485841015
GiGs
Pro
Sheet Author
API Scripter
I'm trying to use an api script to set an avatar image. In the api help it says, " You must use an image file that has been uploaded to your Roll20 Library " and "You can view an image's source URL using the developer tools of your browser." But I dont know how to do this, and google isn't helping me find out.  Normally when i want to inspect an element on a web page, i rightclick the element and select "Inspect", but roll20 has its own right click menu and that option is not available to me.  Can someone give a step by step guide how to do it?
1485851814
Jakob
Sheet Author
API Scripter
You can place the image on the tabletop and press z to zoom it in. In this form, the normal right-click menu is available.
1485853028

Edited 1485853057
plexsoup
Marketplace Creator
Sheet Author
API Scripter
Here's a little test script I use to grab the image source this this macro:  !getImageSrc @{target|token_id} on("chat:message", function(msg) { // use with !getImageSrc @{target|token_id}   //This allows players to enter !sr <number> to roll a number of d6 dice with a target of 4.   if(msg.type == "api" && msg.content.indexOf("!getImageSrc") !== -1) {     var argsFromUser, targetID, targetToken, targetImgSrc;     argsFromUser = msg.content.split(/ +/);     if (argsFromUser.length > 1) {         targetID = argsFromUser[1];     targetToken = getObj('graphic',targetID);     log("targetToken: " + targetToken);         targetImgSrc = targetToken.get("imgsrc");         log("targetImgSrc: " + targetImgSrc);                  sendChat(msg.who, " " + argsFromUser);         sendChat(msg.who, " " + targetImgSrc);              }  else {         sendChat(msg.who, "didn't see any arguments: " + argsFromUser);     }   } else if(msg.type == "api" && msg.content.indexOf("!getTime") !== -1) {         getTime();   }      });
1485863434
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Plex..... might be worth turning it into a "thumb" since API will require that.
1485865319
GiGs
Pro
Sheet Author
API Scripter
I didnt know that, Jakob. Great. Plexsoup, thanks for the script. I'd already found The Aaron had done a script to do the same thing here:  image address script . I like that your version doesn't require to select an image first. 
1485882172
The Aaron
Pro
API Scripter
Stephen actually asked this question last week:&nbsp; <a href="https://app.roll20.net/forum/post/4548528/any-scri" rel="nofollow">https://app.roll20.net/forum/post/4548528/any-scri</a>... I posted a script I wrote there for such.&nbsp;
1485902104
GiGs
Pro
Sheet Author
API Scripter
Haha, The Aaron, my post just before yours refers to that exact script. In my recent browsing of the api scripts form, i have noticed just how many fantastic contributions you have made. You are a great asset to the community.&nbsp;
1485904538
plexsoup
Marketplace Creator
Sheet Author
API Scripter
The Aaron is massively prolific! Also, super helpful and quick to respond.
1485927437
The Aaron
Pro
API Scripter
I'd be more prolific if I could get a few hours to work on things. :)