Discussion Forums  >  Uncategorized

Replies: 6    Views: 701

Marko
buzztouch Evangelist
Profile
Posts: 558
Reg: May 04, 2011
UK, Alcester
8,880
05/14/11 12:26 PM (14 years ago)

Embeded images in HTML

Whilst doing an android app I wanted an offline method to get pictures and text and David from Buzztouch helpfully advised HTML and linking to pics from server.I was wondering if you could embed the image inside the html.As a non programmer I found this on a java forum to embed images into html, it may not be a good way as it seems to generate a large file. And there may be a better way but it may be an method so below is an example Embedding images inside the source of a HTML page It turns out that by using a special data: URL scheme you are able to embed any mime data inside a HTML page, the format is as follows: data:<mimetype>;base64,<data> <mimetype> needs to be replaced by the mime-type of your data (image/png for instance) and <data> is the base64 encoded string of the actual bytes of the file. it may no be effective now as it was from a posted on a java forum in 2005 but worked when I ran it through eclipse emulator
 
Marko
buzztouch Evangelist
Profile
Posts: 558
Reg: May 04, 2011
UK, Alcester
8,880
like
05/14/11 01:24 PM (14 years ago)
Sorry need this inserted in html data:<mimetype>;base64,<data> <mimetype> needs to be replaced by the mime-type of your data (image/png for instance) and <data> is the base64 encoded string of the actual bytes of the file. My pictures starting to mimic my ability to make a correct post
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
05/15/11 11:41 PM (14 years ago)
Hi again... Using Base64 is reasonable approach for 'inline' images in HTML. In fact, many HTML emails you read everyday use this approach. However...the results are so-so at best on a mobile device. Depending on the size of the embedded file, and the device, it may be OK but generally it doesn't work too well. We've tested this on hundreds of files with all different combinations. Most of the results are mediocre.
 
Marko
buzztouch Evangelist
Profile
Posts: 558
Reg: May 04, 2011
UK, Alcester
8,880
like
05/16/11 09:56 AM (14 years ago)
Thanks for the info David. the more I learn of Java and HTML the more I look like my forum pic. Is there a way of having the images with text embedded in the app so users can get the pics and info even when offline. I need to use V1.4 for android. Thanks for all your help and others at buzz touch. The videos are excellent. will await the link for the Webby as without BT I would be stuck doing the Hello World on eclipse
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
05/16/11 09:58 AM (14 years ago)
Gonna be tough to get v1.4 / Android to use embedded images. In fact, not worth the effort - lame experience. Can you make .PDF's or does that not give the same effect? .PDF's sometimes look awesome, sometimes not, kinda depends. We'll get v1.5 for Android done eventually ;-)
 
Marko
buzztouch Evangelist
Profile
Posts: 558
Reg: May 04, 2011
UK, Alcester
8,880
like
05/16/11 10:56 AM (14 years ago)
I will have a go at that. Does a Pdf or word doc embed into the app so that it can be used offline. Can appreciate the problems of doing Android and its less structured SDK. In my opinion in the UK I think that the Android Markeplace will over time take over Apples due to the prohibitive cost of the iphone and contract packages. What people like about apple (I have an ipad & itouch is that they work simply and effectively). Many kids that I have taught Science like the android due to low cost and wide range of handsets. I think most would swap for an iphone if they could.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
05/16/11 12:47 PM (14 years ago)
Couldn't agree more, Android, over time, will probably 'win' .PDF / Word require internet in v1.4... duh... my oversight. Not sure about the best solution for you then, using 1.4 without major hacking.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.