image-input documentation/handling

DrekiOrmur
He/Him

New member
The image-input on the slime2 documentation should probably have a defaultvalue set to show how one would set it.

The pedantic/nitpicky comment out of the way- I know that natively Slime2 is checking only the ./asset folder but when I was playing around, its definitely possible to directory transverse in the Javascript. I don't know if its just an undocumented, 'if you know how, go for it' kind of thing or if the intention is that Slime2 is really only pulling images from the local ./assets folder.

const imageTest = defineSetting('Image','imageTest','group', {
settings:[
defineSetting('Header Icon Image','thisThing1','image-input', {
defaultValue: 'assets/icon-star-yellow.png'
}),
defineSetting('Alert Image','thisThing2','image-input', {
defaultValue: '../../NootNoot.gif'
}),
],
})

SlimeScreenshot01.png
 
Upvote 0

Zaytri
she/her

Glitch Witch
Admin
Developer
Streamer
For a defaultValue it's technically possible, but when a user chooses an image it can only exist in the assets folder. This is because since slime2 is technically a web app, it is unable to know the folder structure on your computer due to browser security. It cannot access images via absolute path (something like C:/users/username/downloads/image.png), only via a path relative to the HTML file. And since it has no way of knowing where on your computer the image came from, or where the HTML file is on your computer, it just assumes that the image exists in the assets folder, and shows an error if it isn't.
 
Back
Top