-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
59 lines (48 loc) · 1.2 KB
/
index.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
<?php
/*Copyright (C) 2015 Aidan Taylor - www.aidantaylor.net - Do not remove this notice*/
(require_once("inc/handle.class.php")) or die("Failed to load");
(require_once("inc/cache.class.php")) or die("Failed to load");
(require_once("inc/imager.class.php")) or die("Failed to load");
$cache = new Cache();
$handle = new Handle();
if (empty($handle->url) || !in_array($handle->get(0), array("head", "helm", "skin"))) {
die();
}
$size = 32;
$user = "";
if (!empty($handle->get(1))) {
$handle1 = str_replace(".png", "", $handle->get(1));
if (!empty($handle->get(2))) {
$handle2 = str_replace(".png", "", $handle->get(2));
if (is_numeric($handle1)) {
$size = $handle1;
$user = $handle2;
} else {
$size = $handle2;
$user = $handle1;
}
} else {
$user = $handle1;
}
} else {
die();
}
$imager = new Imager($user, $cache);
header("Content-Type: image/png");
switch($handle->get(0)) {
case "head":
$head = $imager->renderHead($size);
imagepng($head);
@imagedestroy($head);
break;
case "helm":
$helm = $imager->renderHelm($size);
imagepng($helm);
@imagedestroy($helm);
break;
case "skin":
$skin = $imager->renderSkin($size);
imagepng($skin);
@imagedestroy($skin);
break;
}