-
Notifications
You must be signed in to change notification settings - Fork 0
/
generator.php
executable file
·65 lines (39 loc) · 2.02 KB
/
generator.php
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
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/php
<?php
/**
* Copyright (c) 2013 [email protected]
*
* Licensed under the MIT License (MIT)
*/
include_once __DIR__."/classes/SpriteGenerator.php";
//CONFIG VARS ------------------------------------
//source folder, containing the source pngs
SpriteGenerator::$CONFIG_SPRITEGEN_SOURCEPATH = __DIR__."/sourceimages";
//output folder, the generated files will be placed here
SpriteGenerator::$CONFIG_SPRITEGEN_OUTPATH = __DIR__."/output";
//name of the generated sprite image, full res
SpriteGenerator::$CONFIG_SPRITE_FULLRES_NAME = "sprite2x";
//name of the generated sprite images, low res, so scaled down by 50%
SpriteGenerator::$CONFIG_SPRITE_LOWRES_NAME = "sprite1x";
//if enabled, the script will produce 2 sprites, on based on the original source-images sprites,
//and one with the tiles scaled by 50%.
//In addition, a combined-css files is generated, making use of both sprites depending on the browsers
//pixel density
SpriteGenerator::$CONFIG_GENERATE_LOWRES = true;
//If you'll keep the css and the png files in separate directories, you may add a prefix
//to the png file. This prefix is included in the generated css file, e.g. "../pics/".
SpriteGenerator::$CONFIG_SPRITE_PREFIX = "../pics/";
//If enabled, the script will generate styles for @media print classes.
//In this case, the orignal image is appended by _print, e.g. edit.png will become edit_print.png.
SpriteGenerator::$CONFIG_GENERATE_PRINTSTYLES = true;
// /CONFIG VARS ----------------------------------
include_once __DIR__."/classes/DirectoryReader.php";
include_once __DIR__."/classes/ImageData.php";
include_once __DIR__."/classes/SpriteWriter.php";
include_once __DIR__."/classes/mapper/IDataMapper.php";
include_once __DIR__."/classes/mapper/CssMapper.php";
include_once __DIR__."/classes/mapper/PHPArrayMapper.php";
include_once __DIR__."/classes/mapper/CssCombinedMapper.php";
include_once __DIR__."/classes/mapper/RetinaCssMapper.php";
$objGenerator = new SpriteGenerator();
$objGenerator->generateSprite();