B4J Question B4J write image path in HTML

oldeast

Active Member
Licensed User
Longtime User
Hi, how to write the full image path that contains spaces in html

B4X:
If File.exists(txtImageFolder,txtID&"-1.jpg")Then
            Image1= txtImageFolder&"\"&txtID &"-1.jpg"
                Report=Report &"<tr><td>&nbsp</td><td><img border='1' height='80' src="& Image1 &"></td></tr>"
        End If
if there is a space in the path the full path is truncated, tried
B4X:
Image1= "'" & txtImageFolder &"\"&txtID &"-1.jpg" & "'"

Thanks
 

mangojack

Well-Known Member
Licensed User
Longtime User
B4J ? possibly posted in wrong forum. anyway ...

try using Smart String Literals ...
B4X:
Image1= $" ${txtImageFolder}\${txtID}-1.jpg"$
Report=Report & $"<tr><td>${nbsp}</td><td><img border='1' height='80' src=" Image1"></td></tr>"$

Not full bottle on HTML so unsure if this solves your issue .. you might also want to recheck output.
 
Upvote 0

oldeast

Active Member
Licensed User
Longtime User
Thank you, will try that solution.
Yes that works with slight modification
B4X:
Image1= $" ${txtImageFolder}\${txtID}-1.jpg"$
                Report=Report & $"<tr><td>&nbsp;</td><td><img border='1' height='40' src="${Image1}"></td></tr>"$

Thanks I have leaned about smart string literals.
 
Last edited:
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Try
B4X:
Report = Report & $"<tr><td>&nbsp;</td><td><img border='1' height='80'  src='${File.GetUri(txtImageFolder,txtID&"-1.jpg")}'></td></tr>"$
 
Upvote 0
Top