-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
75 lines (67 loc) · 2.33 KB
/
test.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
<?php
include('./includes/connect.php');
$objects = array('user', 'appearance', 'cost', 'design', 'forums', 'item', 'lot', 'messaging', 'notification', 'personality', 'squffy');
foreach($objects as $object) {
include('./objects/' . $object . '.php');
}
$squffy = Squffy::getSquffyByID(2);
$squffy->getThumbnail();
/*$queryString = "SELECT * FROM species";
$query = runDBQuery($queryString);
$species = array();
while($s = @mysql_fetch_assoc($query)) {
$species[] = strtolower($s['species_name']);
}
$ages = array('child', 'adult', 'hatchling');
$queryString = "SELECT * FROM `appearance_traits` ORDER BY `trait_title` ASC;";
$query = runDBQuery($queryString);
while($trait = @mysql_fetch_assoc($query)) {
$name = $trait['trait_name'];
foreach($ages as $age) {
if($trait['trait_type'] == 1) {
checkIfExists($name, $species, $age);
} else {
checkIfExists($name . 'c', $species, $age);
checkIfExists($name . 'l', $species, $age);
checkIfNotExists($name, $species, $age);
}
}
}
function checkIfNotExists($name, $species, $age) {
foreach($species as $s) {
$img = "../images/generate/$s/$s" . $age . $name . "h.png";
if(file_exists($img)) {
echo 'Need to combine ' . $name . ' for ' . $s . '<br>';
$img = "../images/generate/$s/$s" . $age . $name . "l.png";
echo '<img src="' . $img . '" /><br />';
fixImage($name, $s);
}
}
}
function fixImage($name, $s) {
$location = "../images/generate/$s/$s" . "adult$name" . "h.png";
$img = imagecreatefrompng($location);
imagesavealpha($img, true);
$image_width = imagesx($img);
$image_height = imagesy($img);
$truecolor = imagecreatetruecolor($image_width, $image_height);
$truecolor = $img; //truecolor is the highlights
$location = "../images/generate/$s/$s" . "adult$name" . "l.png";
$img = imagecreatefrompng($location);
imagesavealpha($img, true);
$image_width = imagesx($img);
$image_height = imagesy($img);
$lines = imagecreatetruecolor($image_width, $image_height);
$lines = $img; //truecolor is the highlights
imagecopy($truecolor, $lines, 0, 0, 0, 0, $image_width, $image_height);
imagepng($truecolor, "../images/generate/$s/$s" . "adult$name" . "l.png");
}
function checkIfExists($name, $species) {
foreach($species as $s) {
$img = "../images/generate/$s/$s" . "adult$name.png";
if(!file_exists($img)) {
echo 'Missing ' . $name . ' for ' . $s . '<br>';
}
}
}*/
?>