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

Can't find uploaded image by name

I want to access images I've uploaded. They are visible in my library, initially with the original file name (e.g. 'bla.png'). I can't find them with findObjs({_type: "graphic",name: "bla.png"})[0] nor, after I clicked the name of the image and changed it to 'Bla' with findObjs({_type: "graphic",name: "Bla"})[0] I can, however find one (the last one uploaded, probably) with findObjs({_type: "graphic"})[0] The found object has, not surprisingly, an empty "name" property, but, by accessing its URL I can see it is indeed the image object I was looking for. Here are my questions: Why do images have no non-empty property "name"? How can I assign a name (which if I have control over I will make unique)? What is the preferred (or any) method (property) to find image objects in the API? Ultimately, I want to display the image, scaled, inline in the chat, so if someone has some hint about problems I might encounter using the URL, I'd appreciate it. Thanks Trul
Sorry, "graphics" restricts (as I actually know...) to objects on the playfield. Giving it a name there makes it findable too. I will keep trying from there now.
1721310401

Edited 1721310480
Hello, Just wanted to clarify something that I'm not clear on. When you say you want to access images that you've uploaded, do you mean images in the Art Library? I don't think the API really has access to those in the way you are trying to access them. Roll20 graphic objects  are tokens, maps, and cards that are placed on the VTT. So you can have the API use an image you've uploaded in those Graphic objects. There are imgsrc and avatar properties of objects and you would use the URL of your uploaded objects. But to my knowledge, there isn't a way to just scroll through your uploaded images and select them by file name like "bla.png". EDIT: I see your second post now and you know all that I wrote in my post.