Using your files in JS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Using your files in JS

I have been wondering for a while if I could use images I made on my laptop for characters in my javascript program. If you can do this could someone inform me on how to do so.

5th Jan 2019, 7:28 PM
Zakariya
Zakariya - avatar
13 Answers
+ 2
Zakariya You have to have server or another way to put page on Internet (like some hosting ser ices), there you put page and all resources like img, vid... Then you refer to them like you said before
5th Jan 2019, 11:34 PM
Maneren
Maneren - avatar
+ 2
In HTML make 'img' element then use its 'src' attribute to point to website/cloud where you store your image
5th Jan 2019, 11:01 PM
Maneren
Maneren - avatar
+ 1
So as an example src="car.img"
5th Jan 2019, 11:11 PM
Zakariya
Zakariya - avatar
+ 1
Just make sure the file is private otherwise the page won't ave acces and won't work
5th Jan 2019, 11:12 PM
Maneren
Maneren - avatar
+ 1
On PC, it is easier, just put it in same folder
5th Jan 2019, 11:36 PM
Maneren
Maneren - avatar
0
What do you mean private
5th Jan 2019, 11:12 PM
Zakariya
Zakariya - avatar
0
Like only stored in my pc
5th Jan 2019, 11:13 PM
Zakariya
Zakariya - avatar
0
Fx. In cloud drives only you (with password) have acces.
5th Jan 2019, 11:13 PM
Maneren
Maneren - avatar
0
Or you have to store the img on server together with page
5th Jan 2019, 11:14 PM
Maneren
Maneren - avatar
0
How do i do that
5th Jan 2019, 11:15 PM
Zakariya
Zakariya - avatar
0
Also sorry for the hassle
5th Jan 2019, 11:16 PM
Zakariya
Zakariya - avatar
0
Ok cool. Thanks
5th Jan 2019, 11:37 PM
Zakariya
Zakariya - avatar
0
For nothing
5th Jan 2019, 11:38 PM
Maneren
Maneren - avatar