I have an img in my project (/Content/Img/myPic.png) and i need to transform it into base 64 and save it in a string variable.
Something like:
let myFile = File("/Content/Img/myPic.png");
let fileBase64 = Base64Transformer(myFile);
I don't know how to access my file, and what to use to transform it. Any idea?
Try - angular-file-to-base64-directive , it takes a input
file and preduce a base64
.
Ouput example :
{
"filesize": 54836, /* bytes */
"filetype": "image/jpeg",
"filename": "profile.jpg",
"base64": "/9j/4AAQSkZJRgABAgAAAQABAAD//gAEKgD/4gIctcwIQA..."
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.