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 .
×

You cannot set the imgsrc or avatar of an object unless you use an image that is in your Roll20 Library.

This is probably a simple fix, but I cannot seem to find an imgsrc that will satisfy the API.  I am using the getCleanImgsrc utility function (found in the documentation) along with a function that posts the imgsrc of the selected token to chat. Even with that, the error persists. The images are obviously in my library in these circumstances. Is there something I'm missing? 
1503942607
The Aaron
Pro
API Scripter
Try logging the result of getCleanImgsrc to the API Console Log.  If it's returning a URL, it's usable.  If it isn't there is something wrong with the url.  Paste the URL you're passing in and I'll tell you what it is. Also, be certain you're actually getting this error because of a bad URL and not just because you've left the avatar on a character you're creating blank.  This is a slightly frustrating error because the DEFAULT value of '' (empty string) is invalid by the validation step, resulting in this message.  You see this especially when creating rollable table items as they have the opportunity to associate an image, yet you often don't want to and thus the default image is specified, resulting in this "error".
1503944783
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
In addition to Aaron's points, is the token's sourceimage stored in your library, or is it marketplace content? TheAPIcan only assign imgsrc's that you uploaded (or are stored in another user's library).
1503944924
The Aaron
Pro
API Scripter
Dustin said: The images are obviously in my library in these circumstances. Good point Scott, "my library" is a bit ambiguous here.