forked from heros/Ac0-s-CMS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathicon.php
More file actions
39 lines (34 loc) · 1.06 KB
/
icon.php
File metadata and controls
39 lines (34 loc) · 1.06 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
<?php
DEFINE('BASEPATH', '');
include_once('application/config/config.php');
$icon = (isset($_GET['icon'])) ? $_GET['icon'] : null;
if(empty($icon) || !preg_match("/^[0-9a-zA-Z_]+$/", $icon))
die();
$icon = strtolower($icon);
header ("Content-type: image/png");
$img = imagecreatefrompng($config['base_url'].'content/img/slots/back.png');
imagealphablending($img, true);
imagesavealpha($img, true);
if ($icon)
{
$dest = imagecreatetruecolor(45, 45);
if (@file_exists($config['base_url'].'content/img/icon/items/large/'.$icon.'.jpg'))
{
$icon_create = @imagecreatefromjpeg($config['base_url'].'content/img/icon/items/large/'.$icon.'.jpg');
}
else
{
$icon_create = @imagecreatefromjpeg("http://static.wowhead.com/images/wow/icons/large/$icon.jpg");
@imagejpeg($icon_create, $config['base_url'].'content/img/icon/items/large/'.$icon.'.jpg', 100);
}
if ($icon)
{
imagecopyresized($dest, $icon_create, 0, 0, 0, 0, 45, 45, 56, 56);
imagecopy($img, $dest, 6, 6, 0, 0, 45, 45);
}
}
imagepng($img);
imagedestroy($img);
imagedestroy($dest);
imagedestroy($icon);
?>