This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
img.php
142 lines (112 loc) · 5.88 KB
/
img.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php
/**
* WoWRoster.net WoWRoster
*
* Old Signature Generator
* (Use The AddOn SigGen, it's much better. Zanix just likes to keep this around for his own reasons)
*
* @copyright 2002-2011 WoWRoster.net
* @license http://www.gnu.org/licenses/gpl.html Licensed under the GNU General Public License v3.
* @package WoWRoster
*/
define('IN_ROSTER', true);
$roster_root_path = dirname(__FILE__) . DIRECTORY_SEPARATOR;
require_once ($roster_root_path . 'settings.php'); ## Uses the same settings.php as WoWProfiler
$char = addslashes(urldecode($_SERVER['QUERY_STRING']));
if( is_numeric($char) )
{
$where = ' `member_id` = "' . $char . '"';
}
elseif( strpos($char, '@') !== false )
{
list($name, $realm) = explode('@', $char);
if( strpos($realm, '-') !== false )
{
list($region, $realm) = explode('-', $realm);
$where = ' `name` = "' . $name . '" AND `server` = "' . $realm . '" AND `region` = "' . strtoupper($region) . '"';
}
else
{
$where = ' `name` = "' . $name . '" AND `server` = "' . $realm . '"';
}
}
else
{
$name = $char;
$where = ' `name` = "' . $name . '"';
}
$sitename = $roster->config['website_address']; ## Change this to your web address or a guild motto or whatever
$result = $roster->db->query("SELECT * FROM `" . $roster->db->table('players') . "` WHERE $where LIMIT 0 , 1;");
if( !$result ) ## Checks to see if the character name is in the database, if it's not there then it ends
{
die('Could not query:' . $roster->db->error());
}
## since we are using the same databses as WoWProfiler, the die command was only needed for the
## initial check. You can add it to the rest if you're more comforatable with it there
$getdata = $roster->db->fetch($result);
## Could have just pulled what's needed from the database but left open in case I want to add later
$result2 = $roster->db->query("SELECT * FROM `" . $roster->db->table('guild') . "` LIMIT 0 , 1;");
$getdata2 = $roster->db->fetch($result2);
$result3 = $roster->db->query("SELECT * FROM `" . $roster->db->table('members') . "` WHERE $where LIMIT 0 , 1;");
$getdata3 = $roster->db->fetch($result3);
## Gets the character id number set in the database
$nameid = $getdata['member_id'];
## This sets up the image that is going to be used as the background
## This sets up my font color, this is Black
$im = imagecreatefrompng($roster->config['signaturebackground']);
$color = ImageColorAllocate($im, 0, 0, 0);
## Making it so the servername aligns from the right instead of the left of the image field
$stxtsize = imagettfbbox(6, 0, 'fonts/VERANDA.TTF', $getdata['server']); ## gets the points of the image coordinates
$stxt = $stxtsize[2]; ## pulls the variable for the x point right bottom
$stxtloc = 390 - $stxt; ## Sets the x coordinate where to print the server name
## Making it so the Guild Name is centered in the title box
$gtxtsize = imagettfbbox(14, 0, 'fonts/OLDENGL.TTF', $getdata2['guild_name']); ## gets the points of the image coordinates
$gtxt = $gtxtsize[2] / 2; ## pulls the variable for the x point right bottom, getting the length in pixels of the guild name
$gtxtloc = 237 - $gtxt; ## Sets the x coordinate where to print the guild name
## Making it so the Site Name/motto line is centered in its box
$mtxtsize = imagettfbbox(6, 0, 'fonts/VERANDA.TTF', $sitename); ## gets the points of the image coordinates
$mtxt = $mtxtsize[2] / 2; ## pulls the variable for the x point right bottom, getting the length in pixels of the text
$mtxtloc = 182 - $mtxt; ## Sets the x coordinate where to print the bottombar's text name
## For those who don't know, this is how ImageTTFText() is set up
## ImageTTFText($im, fontsize, fontangle, horizontal point, vertical point, font color, font name/path, Text);
ImageTTFText($im, 6, 0, 85, 20, $color, 'fonts/VERANDA.TTF', $getdata3['guild_title']);
ImageTTFText($im, 14, 0, $gtxtloc, 20, $color, 'fonts/OLDENGL.TTF', $getdata2['guild_name']);
ImageTTFText($im, 6, 0, $stxtloc, 20, $color, 'fonts/VERANDA.TTF', $getdata['server']);
ImageTTFText($im, 24, 0, 85, 51, $color, 'fonts/OLDENGL.TTF', $getdata['name']);
ImageTTFText($im, 7, 0, 85, 65, $color, 'fonts/VERANDA.TTF', 'Level ' . $getdata['level'] . ' ' . $getdata['race'] . ' ' . $getdata['class']);
ImageTTFText($im, 6, 0, $mtxtloc, 77, $color, 'fonts/VERANDA.TTF', $sitename);
## Time for the professions and secondary skills to be shown
## Scrolls through database and finds the 2 main professions then prints them and their skill levels on the signature
$result4 = $roster->db->query("SELECT * FROM `" . $roster->db->table('skills') . "` WHERE `member_id` = '$nameid' LIMIT 0 , 30;");
$pos = 35; # <-- used as the variable for moving the text to the next line. without this it would print the professions right on top of each other
while( $r = $roster->db->fetch($result4) )
{
extract($r);
if( $skill_type == $roster->locale->act['professions'] )
{
ImageTTFText($im, 6, 0, 290, $pos, $color, 'fonts/VERANDA.TTF', $skill_name);
ImageTTFText($im, 6, 0, 355, $pos, $color, 'fonts/VERANDA.TTF', $skill_level);
$pos += 8;
}
}
$pos += 3; # <-- just to put a small space between the primary and secondary professions lists
## Scrolls through database and finds all the secondary skills then prints them and their skill levels on the signature
$result5 = $roster->db->query("SELECT * FROM `" . $roster->db->table('skills') . "` WHERE `member_id` LIKE '$nameid' LIMIT 0 , 30;");
while( $r = $roster->db->fetch($result5) )
{
extract($r);
if( $skill_type == $roster->locale->act['secondary'] )
{
ImageTTFText($im, 6, 0, 290, $pos, $color, 'fonts/VERANDA.TTF', $skill_name);
ImageTTFText($im, 6, 0, 355, $pos, $color, 'fonts/VERANDA.TTF', $skill_level);
$pos += 8;
}
}
## Now to finalize and close
$trans = imagecolorresolve($im, 255, 255, 254);
imagecolortransparent($im, $trans);
## set as png since there are some issues with some using image/gif
header('Content-type: image/png');
ImagePng($im);
ImageDestroy($im);
## The End