Thursday, 7 September 2017

How to convert image into base64 string using javascript



I need to convert my image to a base64 string so that i can send my image to a server.
Is there any js file for this... ? Else how to convert it


Answer



You can use the HTML5 for it:



Create a canvas, load your image into it and then use toDataURL() to get the base64 representation (actually, it's a data: URL but it contains the base64-encoded image).



No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...