TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Data URI Sprites

37 pointsby rama_vadakattualmost 14 years ago

5 comments

Sephralmost 14 years ago
&#62; the images on the page change with every request based on the item specifics, therefore combining them into one sprite image is not possible.<p>It is very possible. Just include the sprite dimensional and positional info in an inline CSS stylesheet on the page and generate a sprite sheet as you would normally. Base64 data: URIs add tons of overhead which will definitely end up being much slower. Not to mention that they're using PNG when they should be using JPEG, which just worsens the issue even more.
评论 #2775550 未加载
评论 #2775592 未加载
评论 #2775532 未加载
评论 #2775544 未加载
rimantasalmost 14 years ago
Unless I am missing something the title is wrong. CSS Sprite means that there are several images in single image file. This is just Data URI encoded images, not sprites. IIRC google used similar technique for the previews of pages in SERPs.
评论 #2775520 未加载
storborgalmost 14 years ago
This is a really cool performance hack. However, doesn't this restrict the effectiveness of the browser cache to just the <i>exact set</i> of images requested at one time? For example:<p><pre><code> - On page load 1, I request images A.png, B.png, and C.png. - The JSON for [A, B, C] is returned and cached. - On page load 2, I request image B.png. </code></pre> I can't use the original file, since it was cached for [A, B, C]. So I have to re-request just B.<p>Is there something I'm missing? Otherwise, it looks really cool.
评论 #2775613 未加载
评论 #2775464 未加载
dmbaggettalmost 14 years ago
Not mentioned, but important for developers: IE8 limits data URIs to 32KB. Any larger than that, and it will refuse to render.
评论 #2777094 未加载
johnx123-upalmost 14 years ago
<p><pre><code> Base64 encoded data URI JSON in single call Vs sprite image in single call </code></pre> I think, vanilla sprite will work much better.