FutureQuest, Inc. FutureQuest, Inc. FutureQuest, Inc.

FutureQuest, Inc.
Go Back   FutureQuest Community > General Site Owner Support (All may read/respond) > General Coding/Development
User Name
Password  Lost PW

Reply
 
Thread Tools Search this Thread Display Modes
Old 12-19-2010, 02:05 AM   Postid: 179224
Jeff
Site Owner
 
Jeff's Avatar

Forum Notability:
872 pts: Dignified Competence!
[Post Feedback]
 
Join Date: Jun 2000
Location: Great Lakes
Posts: 4,223
why base 64 encode images

I notice google is now including large thubmanils of all sites when you search, and interestingly they appear as data:image/jpeg;base64,/9j/4A ...

What is the advantage of base 64 encoding the images like this rather than simply loading them through standard html img src tags?

I also recently noticed the base 64 encoding of a font like
src: local('Font Name'), local('FontFileName-Regular'), url(data:font/opentype;charset=utf-8;base64,T1RUTwAMAIAAAwBA
when this discussion was ongoing http://aota.net/forums/showthread.php?t=25749 and almost asked about the advantage of base 64 encoding the font right in the css file like that.
Jeff is offline   Reply With Quote
Old 12-20-2010, 04:44 AM   Postid: 179228
 Arthur
Developer
 
Arthur's Avatar
 
Join Date: Nov 2000
Location: The Netherlands
Posts: 2,224
Re: why base 64 encode images

That's a good question. I'm not sure what the idea behind including the image as a base64 encoded string. The preview function fires off an Ajax request and the result, with the image data in it, is a JSON object. I'm guessing it prevents the image from being cached plus it reduces the number of browser requests needed to load the images.

Likewise, putting the font in the CSS file like that saves a request to the server to load the font. And it has to be base64 encoded to be binary safe.

-Arthur
__________________
http://www.FutureQuest.net/
Arthur is offline   Reply With Quote
Old 12-20-2010, 02:24 PM   Postid: 179229
Jarrod
Site Owner
 
Jarrod's Avatar

Forum Notability:
334 pts: An Honor To Be Around
[Post Feedback]
 
Join Date: Jan 2003
Location: London, England
Posts: 350
Re: why base 64 encode images

Yes it's to improve your web site response time. Each request to the server has an overhead that with smaller images can be greater than the time taken to actually download the data. Data uri's and base64 encoding allows you to do things like stuff your css with thumbnails. Yes the css goes up in size, but the number of http requests can drop quite a bit. See http://robertnyman.com/2010/01/15/ho...http-requests/ for a fuller explanation, and http://www.spritebaker.com/ if you want to update your CSS.

And see http://googlecode.blogspot.com/2010/...nder-hood.html for an explanation from Google why they are using base64 encoding.

Jarrod
Jarrod is offline   Reply With Quote
Old 12-23-2010, 04:09 AM   Postid: 179237
Jeff
Site Owner
 
Jeff's Avatar

Forum Notability:
872 pts: Dignified Competence!
[Post Feedback]
 
Join Date: Jun 2000
Location: Great Lakes
Posts: 4,223
Re: why base 64 encode images

Makes sense - same basic idea as sprites which I've seen for a while but haven't really started using in mass yet.

Odd how things come full circle -- we all spent a decade slicing things up into little pieces for slow bandwidth and carefully separating by content type, and now we'll go the other way and combine otherwise separate things together to reduce the latency and requests. Makes sense, but it feels a little odd (old dog and new tricks type thing...)
Jeff is offline   Reply With Quote
Old 12-28-2010, 05:25 PM   Postid: 179272
SneakyDave
Fond of TAZ
 
SneakyDave's Avatar

Forum Notability:
93 pts: Helpful Contributor
[Post Feedback]
 
Join Date: Feb 1999
Posts: 921
Re: why base 64 encode images

I haven't heard mention of sprites since the Commodore64 days
SneakyDave is offline   Reply With Quote
Old 12-28-2010, 06:17 PM   Postid: 179273
oheso
Registered User

Forum Notability:
261 pts: An Honor To Be Around
[Post Feedback]
 
Join Date: May 2002
Location: Tokyo, Japan
Posts: 360
Re: why base 64 encode images

Quote:
Originally Posted by SneakyDave View Post
I haven't heard mention of sprites since the Commodore64 days
Similar concept, different context:

http://www.alistapart.com/articles/sprites
oheso is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 visitors)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 09:59 PM.


Running on vBulletin®
Copyright © 2000 - 2014, Jelsoft Enterprises Ltd.
Hosted & Administrated by FutureQuest, Inc.
Images & content copyright © 1998-2014 FutureQuest, Inc.
FutureQuest, Inc.