Mashiane Expert Licensed User Longtime User Nov 11, 2019 #1 Ola I think I did see something like base 64 on the latest version of BANano. Is it possible to get a base64 string from an asset file using that? If so, can help with a snippet be provided please? Thanks TheMash
Ola I think I did see something like base 64 on the latest version of BANano. Is it possible to get a base64 string from an asset file using that? If so, can help with a snippet be provided please? Thanks TheMash
tchart Well-Known Member Licensed User Longtime User Nov 11, 2019 #2 Mash I use StringUtils for this; B4X: Dim s As StringUtils ResultBytes = req.bytes 'You would need to read the bytes of the image file Result = s.EncodeBase64(ResultBytes) You just need to wrap it like so to use as an image; B4X: Preview = $"<img src="data:image/png;base64,"$ & Result& $"" alt="Picture" />"$ Upvote 0
Mash I use StringUtils for this; B4X: Dim s As StringUtils ResultBytes = req.bytes 'You would need to read the bytes of the image file Result = s.EncodeBase64(ResultBytes) You just need to wrap it like so to use as an image; B4X: Preview = $"<img src="data:image/png;base64,"$ & Result& $"" alt="Picture" />"$
Mashiane Expert Licensed User Longtime User Nov 11, 2019 #3 Hopefully this can work with BANano... Thanks. Upvote 0
Mashiane Expert Licensed User Longtime User Mar 26, 2021 #5 Whoa! B4X: Dim dataUrl As String = Banano.Await(Banano.GetFileAsDataURL("./assets/image.png", Null)) Upvote 0