Hi all,
i'm trying to get image from php with android. I use code example from https://www.b4x.com/android/forum/threads/httputils2-web-services-are-now-even-simpler.18992/
This is my php code :
And this is the code in b4a :
first i use
to get encoded base64 string from php.
and the error is arise in :
since m.group(1) result is still in base64 encoded string.
I think i should decode the m.group(1) regular string.
How to to that?
Or maybe i was thinking wrong? please correct me.
i'm trying to get image from php with android. I use code example from https://www.b4x.com/android/forum/threads/httputils2-web-services-are-now-even-simpler.18992/
This is my php code :
PHP:
while($result=mysqli_fetch_array($sth)) {
echo '<img src="data:image/jpeg;base64,' . base64_encode($result['productImg']) . '"/><br>';
}
And this is the code in b4a :
B4X:
Sub HandleMainPage (Job As HttpJob)
imageLinks.Clear
CallSub(ImageDownloader, "ClearCache")
ProgressDialogHide
If Job.Success = False Then
ToastMessageShow("Error downloading main page.", True)
Return
End If
ResetImagesBackground
Dim m As Matcher = Regex.Matcher("([0-9a-zA-Z\+/=]{20,})", Job.GetString)
Do While m.Find
Log(m.Group(1))
imageLinks.Add(m.Group(1))
Loop
DownloadImages
End Sub
first i use
B4X:
Dim m As Matcher = Regex.Matcher("([0-9a-zA-Z\+/=]{20,})", Job.GetString)
and the error is arise in :
B4X:
imageLinks.Add(m.Group(1))
since m.group(1) result is still in base64 encoded string.
I think i should decode the m.group(1) regular string.
How to to that?
Or maybe i was thinking wrong? please correct me.