I am trying to display local images in a webview using the code below. The full webview also includes other HTML, to which this is appended. <html><body> and </html></body> tags are wrapped around it all. The webview displays everything but the images.
The Log output shows this HTML:
As you can see from the screenshots I've attached, the photos are indeed there and they are legitimate jpegs, but they don't display in the webview.
The "FilesDir" referenced equates to rp.GetSafeDirDefaultExternal("").
What am I doing wrong?
As always, thanks for any assistance.
B4X:
Dim Buffer() As Byte 'declare an empty byte array
Dim PhotoType As String
Dim PhotoFilename As String
Photos = ""
Dim rs As ResultSet = B4XPages.MainPage.SQL.ExecQuery("SELECT * FROM session_photo where session_id = '" & B4XPages.MainPage.Session.ID & "'")
Do While rs.NextRow
Buffer = rs.GetBlob("photo")
PhotoType = rs.GetString("photo_type")
PhotoFilename = CodeModule.CreatePhotoFilenameFromData( B4XPages.MainPage.Session.ID, PhotoType )
File.WriteBytes( B4XPages.MainPage.FilesDir, PhotoFilename, Buffer )
Photos = Photos & "<p>" & PhotoType & "<br>"
Photos = Photos & "<img src=""file://" & File.Combine(B4XPages.MainPage.FilesDir, PhotoFilename) & """ style=""width: 90%;""></p>"
Loop
Log(Photos)
The Log output shows this HTML:
B4X:
<p>Developing<br><img src="file:///storage/emulated/0/Android/data/b4a.scallops.ondeck/files/photo_49-1680706554760_Developing.jpg" style="width: 90%;"></p><p>Nematodes<br><img src="file:///storage/emulated/0/Android/data/b4a.scallops.ondeck/files/photo_49-1680706554760_Nematodes.jpg" style="width: 90%;"></p>
As you can see from the screenshots I've attached, the photos are indeed there and they are legitimate jpegs, but they don't display in the webview.
The "FilesDir" referenced equates to rp.GetSafeDirDefaultExternal("").
What am I doing wrong?
As always, thanks for any assistance.