XF 1.1 Smilies as CSS Sprites

With XenForo 1.1, it's now possible to (optionally) define individual smilies from a sprite image. This video shows you just how easy it is to use the system.

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
 
Doesn't look like smilies are per-style still?

At least it looks like it'll be a lot easier to multiple smilies now. One image instead of multiple, and just specifying the appropriate dimensions. (y)
Depending on how its done, a modification couldn't you override the settings via an extra.css call? So if you use the same set with exact dimensions on all, just change the CSS variable to be the style specific sprite sheet?

Edit -- scratch that. It'd be extremely tedious for you... =/ I can see improvements tho in that arena.
 
Kier: I notice you put styles/ etc. in there. Can a @imagepath be used within the field, or must it always be absolute (if a style property could be used), Onimua's issue would be solved I think?
 
Kier: I notice you put styles/ etc. in there. Can a @imagepath be used within the field, or must it always be absolute (if a style property could be used), Onimua's issue would be solved I think?
That was a thought that crossed my mind as well... maybe an optional thing?
 
The smilies aren't part of the style, they are a global setting.

So even using an @imagepath wouldn't help as it would still be a global setting.

Smilies would have to be moved to the style before you could do that.
 
Well the individual smilies (all 35 of them) total 32KB, whereas the sprite is just 8KB.

If you extrapolate that to 100+ smilies then you can see there will be considerable savings in bandwidth and get requests.
 
Offtopic: Where are those smilies? When I reply cannot see any of them...

Edit: With FF I can see them
Edit again: Now with IE as well
 
Ok, so the sprite is cached once and only redownloaded with a hard refresh if I understand it correctly. So larger sprites make it even more efficient then. Doing it for 100+ smileys can take some time though. :p
 
What I like about the way it has been done is that both options are there for everyone to use; so if you don't know about (or care/or want) sprites for your smilies, you can simply carry on regardless and upload individual images (just like every other board software does it).

Win, win!! :D
 
Given the choice I'd switch to smiley sprites, but we have too many which aren't covered in the default pack.
 
I thought it may just have been my eyes but the smilies in the spritesheet (around the edges especially) Are lacking in quality with regards to their smoothness. I'm guessing that is because it's been saved out in .png8 and the smilies use more than the 256 colour range png-8 is limited to.
 
For the record, I don't think there's any mileage in creating sprites for animated smilies, unless you have multiple smilies that all have exactly the same number of frames and run at the same framerate.

I'd anticipate sprites being used for static smiley sets and the default XenForo set, but not for individual smilies added by administrators.

With regard to the question of efficiency, I'd say that if you have a group of smilies that are commonly used, they are good candidates for a sprite. If you have a smiley that is only used in a small number of posts, and is therefore not commonly requested by browsers, it's probably a good idea to exclude that from a sprite and have it load separately on demand. Alternatively, you might want to define a collection of sprites, individually containing smilies that are commonly-used, used sometimes, and used infrequently. The decision is really a matter of a judgement call for individual sites, depending on their smiley usage, and of course, if you don't want to use sprites at all, the tools are there to support that too.
 
I thought it may just have been my eyes but the smilies in the spritesheet (around the edges especially) Are lacking in quality with regards to their smoothness. I'm guessing that is because it's been saved out in .png8 and the smilies use more than the 256 colour range png-8 is limited to.
That's true, but reducing the smilies to 8 bit depth rather than 24 results in a sprite image that is just 8,225 bytes, rather than the 24 bit version, which is more than three times the size, at 29,048 bytes.

On balance, I think that's a good trade-off, and I doubt that anyone except the smilies' creator would really notice the difference :)

Screen Shot 2011-09-21 at 09.24.17.webp Screen Shot 2011-09-21 at 09.24.19.webp
 
With regard to the question of efficiency, I'd say that if you have a group of smilies that are commonly used, they are good candidates for a sprite. If you have a smiley that is only used in a small number of posts, and is therefore not commonly requested by browsers, it's probably a good idea to exclude that from a sprite and have it load separately on demand.

Beat me to it Kier, in the animated gifs example on a previous post, it would be pointless grouping them unless they were used on every page, otherwise you'll be downloading a load of baggage that wasn't used on every page. Not to mention pallette clashes & all nasty things - as Kier says, its just not practical.

Sprites really only need to be used on commonly used images, otherwise yes you save requests, but at the expense of bandwidth.
 
That's true, but reducing the smilies to 8 bit depth rather than 24 results in a sprite image that is just 8,225 bytes, rather than the 24 bit version, which is more than three times the size, at 29,048 bytes.
You can still have 8 bit depth & alpha transparency though can't you? Of the PNGs I've used & made, I've always done 24 bit and alpha.
 
That's true, but reducing the smilies to 8 bit depth rather than 24 results in a sprite image that is just 8,225 bytes, rather than the 24 bit version, which is more than three times the size, at 29,048 bytes.

On balance, I think that's a good trade-off, and I doubt that anyone except the smilies' creator would really notice the difference :)

View attachment 18969 View attachment 18970

I checked the file sizes and totally agree in that case it's definitely the logical choice. It's just that I notice it now that i mentioned it. :P My concern is with an extended pack in the pipeline, on the same sheet i think for quality purposes you'll be struggling to retain quality with the additional colour range. I'm going to test that out in a moment and check to see if the quality is drastically reduced with the extended ones added.
 
I checked the file sizes and totally agree in that case it's definitely the logical choice. It's just that I notice it now that i mentioned it. :p My concern is with an extended pack in the pipeline, on the same sheet i think for quality purposes you'll be struggling to retain quality with the additional colour range. I'm going to test that out in a moment and check to see if the quality is drastically reduced with the extended ones added.
Regarding the extended smiley pack, my preference would actually be to distribute two separate smilie sprites, one for all the common smilies, as used now, and a second one for the extended collection. Let's chat later to discuss it further :)
 
Top Bottom