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

[Help] Is there a clean way to call the 'thumbs' size of imgsrc property?

Hey, rather than using a text mess in my code like <a href="https://s3.amazonaws.com/files.d20.io/images/7283887/D7ynazvDXdxXmY9OaiWRTw/thumb.png?1421955614" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/7283887/D7ynazvDXdxXmY9OaiWRTw/thumb.png?1421955614</a> is there any way to use something like imgsrc: burst_15.get("imgsrc"), ?
1421964283
The Aaron
Pro
API Scripter
If you already have a graphic object named burst_15, then yes. I saw a video (lower in API Forum) where a guy has a bunch of graphics pulled in and sized and named a particular way, then pulls them into his script as part of his startup (presumable in on('ready',...) ). You could do something similar. Bear in mind that you will only be able to set the imgsrc to a URL for an image that is in a User's library. It doesn't have to be the current user, but does have to be a user. You cannot use the url of an image that is in the marketplace, for example, unless it has been downloaded and reuploaded to a user library first.
Yeah, think the video you mentioned is the script i'm tinkering with, currently have the (locally uploaded) graphics all in and ready, but i think his script is from before the restrictions on the thumb size, so he literally uses the code in the original post to set the imgsrc. Just trying to work out if something like imgsrcThumb or some spinoff of the imgsr property exists that i'm not aware of so i could call it for all of the tokens rather than putting static links in my code.
1421968530
The Aaron
Pro
API Scripter
Ah. I think I misunderstood the issue. Are you hitting the problem that burst_15's imgsrc is for the max.png? imgsrc: burst_15.get('imgsrc').replace(/max\.png/,'thumb.png'), or if you're doing this a lot: var thumb = function(imgsrc) { return imgsrc.replace(/max\.png/,'thumb.png'); }; // [...] imgsrc: thumb(burst_15.get('imgsrc')),