How to Convert Images Into Base 64 Data URLs with JavaScript

preview_player
Показать описание
In today's tutorial I'll show you how to convert an image to data URL in JavaScript. This is very easy to do by using the FileReader object.

For your reference, check this out:

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!

#dcode #javascript #webdevelopment
Рекомендации по теме
Комментарии
Автор

🔽 CONVERT CANVAS INTO BASE64 URL 🔽

🎓 COMPLETE JAVASCRIPT CRASH COURSE FOR BEGINNERS 👇:

dcode-software
Автор

1) Can we convert that very long url to a very short url and get the same image as result?
2) this data url will only works for images? Or we can use it for any files?
3) I tried to create a download link for an image with data-url in the anchor tag. but when I click on the anchor tag, it doesn't show me the image as a result! Just shows a blank screen! And I have to reload that blank screen to see the image! Y is this happening? What should I do?

(my native language isn't English, so... Sorry if I did something wrong in my words 😁)

pouriyanourouznejad
Автор

Can i achieve this results with js only? Without using the file input?

earlchesterantonio
Автор

Can we get this data type just giving local url? (exmp : img.src = "images/sample.jpg")

erturkyorulmaz
Автор

can we save that url in database and use it as an image url to show on the website?

abdullahalrezarohan
Автор

Haha, a few weeks after doing this myself. I wish I could tell past me to procrastinate a little and just watch this

hikari
Автор

Bro I am. Working on a project, and that where I had to use your this method for image to be stored in local storage but now I want to send it to the server so it want this base 64 url image to be as it was in file object, so how can I basically make the back after making a image into string base 64 to its original face

faaizalam
Автор

Thank You, i need a help please how to upload image as base64 in dexie.js database ?

yassineabdelouafi
Автор

<img id="Img712" src="data:image/gif;base64, /9j problems slolution pleas sir

prakashchaure
Автор

I got errors on jpg so this is the code i use u can wrap a function around it
return new Promise((res, rej) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {

};
reader.onerror = (err) => {
rej(err);
};
});

jefferyaaron
Автор

I really need to know how to get the file as blob without using the form parent tag . Thanks

Acuceibdj
Автор

I need the rest of the video. or any other video to watch

Funny-collector
Автор

How to convert any image address which is uploaded at any website, that's how to convert In Blob

getsetalk
Автор

off
what should i do after i learn vanila js ?

Muhammad-bpdq
Автор

Theme vs code, please 😁, and thanks for helpe

naiandersonbruno
Автор

If you want to beat the market or become a millionaire, the first thing you need to do is, to get financial education. a fellow creator][[]][

yasinnabi
Автор

Ive said this before on your videos I’ll say this again, these videos have very little to do with software engineering or improving your skills as a software developer and more to do with being good at following step by step instructions, aka tutorials. Channels like these are detrimental for beginners, this is not how problem solving skills are developed. Now I understand if you are showing how to solve problems or atleast make something challenging, but who the needs videos that are 4-10 mins long where you can literally google it in 30 seconds. This is contenting whoring and fishing for subscribers. It’s like language learning channels that never go past the first level

nanonorthlabs