Skip to content

Instantly share code, notes, and snippets.

@ckwalsh
Created February 11, 2011 11:17
Show Gist options
  • Save ckwalsh/822217 to your computer and use it in GitHub Desktop.
Save ckwalsh/822217 to your computer and use it in GitHub Desktop.
<?php
/* Include the files/set up autoloading */
$packer = new Sprite_Packer_Greedy_Heap();
$map = new Sprite_Map($packer);
$images = array();
$images[] = new Sprite_Image_Url('http://static.reddit.com/reddit.com.header.png');
$images[] = new Sprite_Image_Url('http://static.php.net/www.php.net/images/php.gif');
foreach ($images as $img) {
$map->addImage($img);
}
var_dump($map->getBlocks());
imagepng($map->getImage(), 'out.png');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment