Alberto Michelis Well-Known Member Licensed User Longtime User Jul 8, 2019 #1 Hi, trying to test this library https://www.b4x.com/android/forum/threads/base64-encode-decode-image-library.31031/ Using a button and a text field to see the resulting blob2base64. Im getting an error in the folowing code: Code: Copy Sub btnVerBlob64_Click Log("Pasando " & TesteoPHP.ViendoImagen & " a base64") Dim B64Str As String = Base64Con.EncodeFromImage(File.DirDefaultExternal, TesteoPHP.ViendoImagen) txtBlob64.Text = B64Str End Sub TesteoPHP.ViendoImagen is the mage name and it really exists. The error is : java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String anywheresoftware.b4a.objects.StringUtils.EncodeBase64(byte[])' on a null object reference
Hi, trying to test this library https://www.b4x.com/android/forum/threads/base64-encode-decode-image-library.31031/ Using a button and a text field to see the resulting blob2base64. Im getting an error in the folowing code: Code: Copy Sub btnVerBlob64_Click Log("Pasando " & TesteoPHP.ViendoImagen & " a base64") Dim B64Str As String = Base64Con.EncodeFromImage(File.DirDefaultExternal, TesteoPHP.ViendoImagen) txtBlob64.Text = B64Str End Sub TesteoPHP.ViendoImagen is the mage name and it really exists. The error is : java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String anywheresoftware.b4a.objects.StringUtils.EncodeBase64(byte[])' on a null object reference
KMatle Expert Licensed User Longtime User Jul 9, 2019 #2 Check the filename (case sensitive) Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jul 9, 2019 #3 You don't need to use a library other than StringUtils. Get the bytes and convert to image: https://www.b4x.com/android/forum/threads/b4x-bytes-to-file.70111/#post-445167 Upvote 0
You don't need to use a library other than StringUtils. Get the bytes and convert to image: https://www.b4x.com/android/forum/threads/b4x-bytes-to-file.70111/#post-445167
GabrielQ Member Licensed User Jul 20, 2019 #4 Erel said: You don't need to use a library other than StringUtils. Get the bytes and convert to image: https://www.b4x.com/android/forum/threads/b4x-bytes-to-file.70111/#post-445167 Click to expand... Hi! I've the same error... but, Alberto and me needs past image to base64 string, not bytes to image. TKHS! Upvote 0
Erel said: You don't need to use a library other than StringUtils. Get the bytes and convert to image: https://www.b4x.com/android/forum/threads/b4x-bytes-to-file.70111/#post-445167 Click to expand... Hi! I've the same error... but, Alberto and me needs past image to base64 string, not bytes to image. TKHS!
Erel B4X founder Staff member Licensed User Longtime User Jul 21, 2019 #5 Convert the image to bytes: https://www.b4x.com/android/forum/threads/b4x-bytes-to-file.70111/#post-445167 Convert the bytes to base64 string with StringUtils.EncodeBase64. Upvote 0
Convert the image to bytes: https://www.b4x.com/android/forum/threads/b4x-bytes-to-file.70111/#post-445167 Convert the bytes to base64 string with StringUtils.EncodeBase64.
GabrielQ Member Licensed User Jul 21, 2019 #6 Erel said: Convert the image to bytes: https://www.b4x.com/android/forum/threads/b4x-bytes-to-file.70111/#post-445167 Convert the bytes to base64 string with StringUtils.EncodeBase64. Click to expand... Hi Erel, thks !!! I can with: Dim auxStringUtils As StringUtils auxStringUtils.EncodeBase64(Bit.InputStreamToBytes(File.OpenInput(genDirectorioCamara, "me_picture.jpg"))) Regards !!! Upvote 0
Erel said: Convert the image to bytes: https://www.b4x.com/android/forum/threads/b4x-bytes-to-file.70111/#post-445167 Convert the bytes to base64 string with StringUtils.EncodeBase64. Click to expand... Hi Erel, thks !!! I can with: Dim auxStringUtils As StringUtils auxStringUtils.EncodeBase64(Bit.InputStreamToBytes(File.OpenInput(genDirectorioCamara, "me_picture.jpg"))) Regards !!!