-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcsssprite.example.php
More file actions
executable file
·55 lines (46 loc) · 1.36 KB
/
csssprite.example.php
File metadata and controls
executable file
·55 lines (46 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
*
* PHP CSS Sprite generator example
*
* this is an example usage of the css sprite library
* chmod your outpath so its script writeable.
*
* Devin Smith www.devin-smith.com 2009.06.18
*
*/
require_once 'CssSprite.php';
$images['devin']['file'] = 'devinsmith.logo.png';
$images['devin']['style']['margin'] = '0 auto';
$images['charitycall']['file'] = 'charitycall.logo.png';
$images['charitycall']['style']['margin'] = '0 auto';
$sprite = new CssSpriteMap();
$sprite->setImages($images)
->setInPath('./')
->setForceRefresh(false)
->setCssPrefix('csssprite')
->setOutPath('./cache/')
->setOutUrl('cache/')
->create();
/**
* get the css and display it in your header
*/
$css = $sprite->getCss();
/**
* contains the image information of the sprite you want (optional)
*/
$mySprite = $sprite->getImg('devin');
/**
* sloppy output!
*/
?>
<html><head><title>Css Sprite Generator Example</title>
<style type="text/css">
<?=$css?>
.<?=$sprite->getCssPrefix()?> span { display: none; }
</style>
</head><body>
<div class="<?=$sprite->getCssPrefix()?> <?=$sprite->getCssPrefix()?>devin center"><span>www.devin-smith.com</span></div>
<br /><br />
<div class="<?=$sprite->getCssPrefix()?> <?=$sprite->getCssPrefix()?>charitycall center"><span>charitycalliphone.com</span></div>
</body></html>