Embedded image test...

From: Peter (BOUGHTONP) 4 Sep 2009 21:14
To: ALL1 of 18
I just found out you can embed images as base64 in HTML.

HTML code:
<img alt="a cube" src="data:image/png;base64,iVBORw....nTsAAAAASUVORK5CYII="/>


a cube


/me files under "Cool things I'll probably never actually need".


I guess if you need to generate lots of small temporary uncached files it could be useful?
From: Dan (HERMAND) 5 Sep 2009 09:43
To: Peter (BOUGHTONP) 2 of 18
That's quite cool
Embedded Image
EDITED: 5 Sep 2009 09:45 by HERMAND
From: Dan (HERMAND) 5 Sep 2009 09:48
To: Peter (BOUGHTONP) 3 of 18

Doesn't seem too keen on big images here. Dunno if that's beehive or IE, but if I go to the image properties it doesn't display all the code (Hence why the image isn't complete).

 

Still very interesting though - could be used where you want to distribute a single HTML doc with images or something. Actually, I can think of a few uses in a restricted environment. It wouldn't even be THAT untidy if you used CSS.

From: Matt 5 Sep 2009 10:33
To: Peter (BOUGHTONP) 4 of 18
S'clever innit.

You can use your example in CSS, with the background property, which could possibly make for some really hard to save images.

code:
background-image: url('data:image/png;base64,iVBORw....nTsAAAAASUVORK5CYII=');


You can do put content other than images in there as well, including base64 encoded CSS and Javascript but browser support as usual is sketchy. The biggest downside is support for this was only added to IE in 8.0 and then it only permits them up to 32K in size (possibly why Dan is having problems with large images), due to security concerns over malicious content. IE 7 and older simply don't support it.
From: Mal (BAD) 5 Sep 2009 10:52
To: Peter (BOUGHTONP) 5 of 18

Won't that just kill your bandwidth? A image converted to text is always going to be twice the size.

 

I'm struggling to see the point :/

 

EDIT: It's Base64 though innit so not twice the size. My bad. Still bigger though.

 

EDIT2: I suppose it might be useful for HTML emails - no need to worry about maintaining image attachments etc. Not that that's especially difficult.

EDITED: 5 Sep 2009 10:57 by BAD
From: koswix 5 Sep 2009 12:26
To: Matt 6 of 18
I'm amazed the blackberry browseer supports it! If verry slowly.
From: Mouse 5 Sep 2009 12:41
To: ALL7 of 18
Just out of interest would this make supporting cross email clients easier? Cos they're a bit of a nightmare to get looking correct on everyone's clients. No standardisation and that.
From: koswix 5 Sep 2009 12:47
To: Mouse 8 of 18
Or you could just shove your Google powered Kroncong spam up your /BUM/ :@
From: Mouse 5 Sep 2009 12:48
To: koswix 9 of 18

:'D

 

<adds Kos's email 5 more times to spam list>

From: Peter (BOUGHTONP) 5 Sep 2009 15:34
To: Dan (HERMAND) 10 of 18
Worked fine in Chrome, so it must be IE as Matt suggests.
From: Peter (BOUGHTONP) 5 Sep 2009 15:34
To: Mal (BAD) 11 of 18
What about using JS to generate a smooth gradient background image on the client?
Can't do that easily in one request normally (would need to know window size), but client-side wouldn't be too tricky - and it would likely be less data than the equivalent image too.
From: Peter (BOUGHTONP) 5 Sep 2009 15:34
To: Mouse 12 of 18
Not really - images aren't really the main issue with emails, it's support for other things like widths, margins, and so on.
From: koswix 5 Sep 2009 17:42
To: Mouse 13 of 18

Not sure I'm on yer spam list tbh, which is odd. Sure I used to be.

 


Also I am running out of obscure string instruments to acuse you of selling.

From: Mouse 6 Sep 2009 01:45
To: koswix 14 of 18
I haven't sent one for a few weeks :$
From: koswix 6 Sep 2009 10:41
To: Mouse 15 of 18
The Thought Police Google won't be happy with you. And those BordonĂșas won't sell themselves, you know.
EDITED: 6 Sep 2009 10:42 by KOSWIX
From: Mal (BAD) 6 Sep 2009 13:08
To: Peter (BOUGHTONP) 16 of 18
Fair point - hadn't thought of that. I suppose it allows you to offload any sort of image processing/generation to the client - albeit at the cost of having to re-run it on every refresh? Might be painful for mobile users with slow js processing though!
From: Peter (BOUGHTONP) 6 Sep 2009 13:37
To: Mal (BAD) 17 of 18
Well refreshing is becoming a rarer event with all this asynchronous loading, so that's less of a problem.
Though it would be good if browser caches allowed manual insert/retrieval using JS - easier than faffing with cache control headers!

Slow JS processing for mobile devices could be an issue, but with 800MHz CPUs just around the corner, it shouldn't be much of an issue for long?
From: Ally 6 Sep 2009 17:00
To: Peter (BOUGHTONP) 18 of 18
You sort of could make a gradient- use SVG for Firefox and Safari, and a CSS filter for IE. The IE part isn't valid, but then this method doesn't work it in it at all...