Loading a local jpeg file

So I have an HTMLViewer with a bit of HTML like this to display a background image:

theHTML = “

I just replace %%coverURL%% with the actual url, and all works great.

Now I want to use a previously downloaded jpeg file I have on disk, in case the user has lost net access. I set CoverFolderItem to the correct local file, then try this:

If CoverFolderItem.Exists then
Dim pic As Picture = Picture.Open(CoverFolderItem)
theHTML = “

theHTML = ReplaceAll(theHTML, “%%pic%%”, pic.ToString )
end if

Again, this does work, but it’s crazy slow. For a 2MB jpeg file on my local drive, I get the spinning beach ball for a solid 9 seconds before it then displays the image correctly.

Is that level of delay expected in this situation?

A 2 MB file is awfully big for a browser, and encoding it as Base64 makes it even twice as big…

Why not use a local url? Replace %%coverURL%% with CoverFolderItem.URLPath.

Well that worked beautifully!

I hadn’t thought of a local url path. Exactly the type of insight I was hoping I’d missed.

Thank you!!