aeric Expert Licensed User Longtime User Oct 5, 2018 #1 Hi guys, I download an image from my server and store in File.DirDocuments. I want to display the image in webview using html but the image doesn't show. I log the destination folder and show: Code: myimage.jpg written to /var/mobile/Containers/Data/Application/5E43A1B2-2468-123B-A456-B1BB22F330BC/Documents/ I build my html like: Code: strHtml = strHtml & $"<p><img src="file://"$ & File.Combine(File.DirDocuments, "myimage.jpg") & $"" width="100%"></p>"$ Is there a workaround?
Hi guys, I download an image from my server and store in File.DirDocuments. I want to display the image in webview using html but the image doesn't show. I log the destination folder and show: Code: myimage.jpg written to /var/mobile/Containers/Data/Application/5E43A1B2-2468-123B-A456-B1BB22F330BC/Documents/ I build my html like: Code: strHtml = strHtml & $"<p><img src="file://"$ & File.Combine(File.DirDocuments, "myimage.jpg") & $"" width="100%"></p>"$ Is there a workaround?
aeric Expert Licensed User Longtime User Oct 5, 2018 #2 I change my HTML to the following so the webview just load the image from the server: strHtml = strHtml & $"<p><img src="https://mydomain.com/images/"$ & strfilename & $"" width="100%"></p>"$ Just wondering whether webview able to load the image from device storage such as File.DirDocuments? Upvote 0
I change my HTML to the following so the webview just load the image from the server: strHtml = strHtml & $"<p><img src="https://mydomain.com/images/"$ & strfilename & $"" width="100%"></p>"$ Just wondering whether webview able to load the image from device storage such as File.DirDocuments?
Erel B4X founder Staff member Licensed User Longtime User Oct 7, 2018 #3 You are not using the string literal correctly. Code: strHtml = strHtml & $"<p><img src="file://${File.Combine(File.DirDocuments, "myimage.jpg")}" width="100%"></p>"$ You can load images from File.DirDocuments. Example: Code: File.Copy(File.DirAssets, "smiley.png", File.DirDocuments, "1.png") WebView1.LoadHtml($"<img src="file://${File.Combine(File.DirDocuments, "1.png")}"/>"$) Upvote 0
You are not using the string literal correctly. Code: strHtml = strHtml & $"<p><img src="file://${File.Combine(File.DirDocuments, "myimage.jpg")}" width="100%"></p>"$ You can load images from File.DirDocuments. Example: Code: File.Copy(File.DirAssets, "smiley.png", File.DirDocuments, "1.png") WebView1.LoadHtml($"<img src="file://${File.Combine(File.DirDocuments, "1.png")}"/>"$)
aeric Expert Licensed User Longtime User Oct 7, 2018 #4 Thanks Erel. Will try the code later. Upvote 0