Android Question [Closed]Embed images to HTM file

Roger Daley

Well-Known Member
Licensed User
Longtime User
Hi All,

I am looking for a simple method to embed images to a HTM file so the user can export the HelpFile to the SD Card [and beyond] as a single file.

NOTE: The HTM file is a Word Doc saved as HTM to enable it to be read in WebView. I know this is the wrong way to create a HTM but I was not trying to create a Web Page but trying to let the user read the document. This also shows my level of skill in HTM/L, Web Pages etc.

My choices at this stage are:
1. Find a simple way to embed the images.
2. Convert file to PDF. [HTM for WebView, PDF for exporting to the SD Card.]
3. Any other suggestions?

Regards Roger
 
Last edited:

JohnC

Expert
Licensed User
Longtime User
I don't know of any way to "embed" an image into an HTML "file" other then the MHT format, but thats a whole other can of worms.

You could just have normal <img> links in the HTML file that references image on the web, but that would require the user to have internet access to see the images when they open the file in a browser.

The "PDF" solution is a common file format, and will allow the image to be embedded into one "file" without the need for internet access - so this might be your best bet.
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
Thanks JohnC.
Pretty much as I thought but worth asking just in case. ?
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
You can embed images using base64 in the image tag

for example,

B4X:
<img  alt="embedded images"
src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD...TRUNCATED....UUUUAFFFFABRRRQAUUUUAFFFFAH/9k=">

I use this method in my email signatures to ensure that the recipient Always sees my logo even if they have download images turned off.

There are plenty of online sites which allow you to convert an image into based64.

Just type Image to Base64 into Google.
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User

Andrew,
Interesting!!
I will give it look.

Regards Roger
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User

Andrew,
Read through Base64/images, very interesting. However being a lazy bugger I'll stick with the PDF for now as it is already working.

A thought, I see an opportunity for someone who knows what they are doing [you not me], to write an App that embeds images into HTML files.

Regards Roger ?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…