Location: PHPKode > scripts > CSS sprite class > examples/image_output_example.php
<?php

/*
 * This example shows how to output image to browser or get GD image resource
 */
 
//declaring class instance
include("../css_sprite.class.php");
$sprite = new spritify();

//adding test images
$sprite->add_image("../test_images/php.jpg", "jpeg");
$sprite->add_image("../test_images/php.gif", "gif");
$sprite->add_image("../test_images/elephpant.png", "elephant");

//retrieving error
$arr = $sprite->get_errors();
//if there are any then output them
if(!empty($arr))
{
	foreach($arr as $error)
	{
		echo "<p>".$error."</p>";
	}
}
else
{
	//returns GD image resource
	//$img = $sprite->get_resource();
	
	//outputs image to browser
	$sprite->output_image();	
}
?>
Return current item: CSS sprite class