Here is a working dev version of the sprite module. There are currently four ways to use it on your site...

  • theme("sprite", $filepath, $alt = "", $title = NULL, $attributes = array(), $context = "general", $override_width = NULL, $override_height = NULL, $offset_width = NULL, $offset_height = NULL)
  • "Sprite HTML" image formatting option in views and in the content type display fields config page
  • "<imagecache_preset> sprite" image formatting option in views and in the content type display fields config page
  • sprite_register($filepath = NULL, $context = "general", $override_width = NULL, $override_height = NULL, $offset_width = NULL, $offset_height = NULL)

Here are the known issues / things I'm still working on...

  • Currently it only works with jpg and gif output types... pngs are still buggy
  • Currently it doesn't use ImageAPI, so it requires GD
  • Parsing the CSS for background images and adding them to a sprite
  • Optimizing the code to run quicker
  • Trying to find a way to apply the imagecache preset without reading the imagecache file from disk to avoid image degradation due to multiple lossy compressions
  • Cleaning up the code and documenting it

Here are some notes...

  • If you call theme() or sprite_register() with a path to an imagecache file and it doesn't exist yet, the sprite module will try to determine the preset and will generate the imagecache file automatically
  • While the module improves frontend performance in most cases, I have experienced a performance hit when implementing the sprites for multiple larger images... so don't use it blindly sometimes you might be better off without it
  • I alluded to it in the known issues list, but you will see some image quality degradation since you are using jpegs as your source material (and in the case of an imagecache image, a jpeg of a jpeg). If you notice an image quality drop you can bump up the Image Toolkit quality setting
  • There are some configuration settings and the ability to flush generated sprites via Site Configuration > Sprite
CommentFileSizeAuthor
#3 sprite.tar_.gz12.67 KBd.clarke
#1 sprite.tar_.gz12.52 KBd.clarke

Comments

d.clarke’s picture

StatusFileSize
new12.52 KB

Update to replace the term 'context' in the sprite module to 'registry' to eliminate any potential confusion with contexts in ctools and core in Drupal 7. I also think it is the term that Aaron originally intended to use for that feature.

gagarine’s picture

Its committed?

d.clarke’s picture

StatusFileSize
new12.67 KB

I'm still working on getting commit access, but in the meantime here is a cleaned up version of the code.

aaron’s picture

this looks really good! thanks for the hard work, dale!

d.clarke’s picture

This has been committed and a dev version has been published. Please use that version moving forward.

Thanks,
Dale

gagarine’s picture

Status: Active » Fixed

Nice!!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.