+ 5
if we want a gallary img or audio in our code, how can we upload it?
3 ответов
+ 9
https://www.sololearn.com/discuss/1073871/?ref=app
1. Find an audio you want and download it. For example some gunshot audios can be found here: https://www.soundjay.com/gun-sound-effect.html
2. Cut audio (optional)**
3. Upload audio on dropbox
4. Share it's link on dropbox
5. Copy shared link and paste it in src of your audio tag
6. And the most important thing -> instead of 'www' put 'dl' (Check out code example)
** After you download a desired sound, it can often have a certain 'no sound' region. I suggest you to use some audio cutter to leave only the part you need (useful for rapid fire). There are plenty of cutters on web.
https://code.sololearn.com/WUhX3W6925bT/?ref=app
+ 7
You can only link images that are live on the Internet. I'm really sure that there's no way to link a local image directly from your phone (using a URL).
Also: All codes on the Code Playground are located on SoloLearn's database. If you try to link local images on the Code Playground, they'd better be in the same directory as the code that you are linking them too. Your phone does not hold SoloLearn's database!
There are two solutions to this problem. The first one is quite simple. For this simple solution, all you have to do is upload your image to a website like imgur and use the address there.
Second solution is to convert the image to Base64 and use it at the value of the src attribute. This is like putting the image file directly into the HTML file. It's possible to do in the Code Playground.
There are plenty of websites that let you convert an image to Base64. All you have to do is upload the image, copy the text that is produced, and then use that text in place of the URL of the image in the src attribute.
For example: <img src="data:image/png;base64,iVBORw0K..."/>
I hope this helps you!
Credit :: @Erik Johanson