Image path for my code


how can i get image path that in assets |
because i want the path for my code to use it as background
i mean path like : assets/img11.png
i tried that but failed
and thanks :slight_smile:


If you click on the uploaded asset in assets you can copy its URL to use in your project.


I know but in canvas i can’t use the URL
So i should use the path
Can i get it ?


Yes, by using assets-lib: see


Oh :scream_cat: broo thx …
I tried it but with out var assets … Cuz that it doesn’t work with me .
Thx for help . :+1:


but another question i tried like that :
no one works wih me it says that no file in this name ,but im sure that the file name is 11.png in assets . any solution for that ?
ex :


It’s likely the path to the asset isn’t correct. Try prefacing that path with __dirname e.g. path = __dirname + ‘/assets/11.png’.


the err was no such file ‘app/assets/11.png’ for this time :joy:


DM me a join link for your project and I’ll take a look.


Ah, sorry - You’re trying to reference the images using the relative path on the server-side. Assets-lib is for client-side only. For server-side you’d need to copy the images locally, using wget from the console.