Skip to content

CSS / Image Sprite Generator written in PHP. First version to be used on the CLI, web based view may follow.

License

Notifications You must be signed in to change notification settings

sidler/phpImageSpriteGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phpImageSpriteGenerator

CSS / Image Sprite Generator written in PHP. First version to be used on the CLI, web based view may follow.

(c) by Stefan Idler, MulchProductions, [email protected], http://www.mulchprod.de

Usage

phpImageSpriteGenerator requires at least PHP 5.3 and the gd-lib module. Place all tiles (so all source images) in the "sourceimages"-folder and call the "generator.php"-script using the command line.

All options may be configured in generator.php.

The script will generate a sprite-image in the folder "output". In addition to the sprite, the following files are generated by default:

  • a file sprite1x.png, containing the tiles scaled down by 50%

  • a file sprite2x.png, containing the tiles in full resolution

  • a css file sprite1x.css with the matching background-position values for the lowres tiles

  • a css file sprite2x.css with the matching background-position values for the highres tiles

  • a php-file sprite1x.php with an array of source-images to background-positions for the lowres tiles

  • a php-file sprite2x.php with an array of source-images to background-positions for the highres tiles

  • a css-file combined.css, containing the css-data to use either the lowres or the highres tile based on the clients pixel density

  • a css-file combines_fullres.css, containing the css data to use the highres sprite for all pixel densities (downscaling is handled by the browser)

The php files are extremely useful if you need the positions directly in your php-script, e.g. to process the values.

About

CSS / Image Sprite Generator written in PHP. First version to be used on the CLI, web based view may follow.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages