My Avatar.php, if you didn't guess, is my file that'll update whenever a user wears a differant hat or other Item. It comes up as an invalid/removed image file.
I don't see what's wrong with it ; please help.
Avatar.php Code :
I don't see what's wrong with it ; please help.
Avatar.php Code :
PHP:
<?
$connection = mysql_connect("localhost","tropicfa_db","roblox99");
mysql_select_db("tropicfa_db");
$ID = mysql_real_escape_string(strip_tags(stripslashes($_GET['ID'])));
$Username = mysql_real_escape_string(strip_tags(stripslashes($_GET['Username'])));
if (!$Username) {
$getUser = mysql_query("SELECT * FROM Users WHERE ID='".$ID."'");
}
else {
$getUser = mysql_query("SELECT * FROM Users WHERE Username='".$Username."'");
}
$gU = mysql_fetch_object($getUser);
//stuff
$Body = $gU->Body;
if (empty($Body)) {
$Body = "Transparent.png";
}
$Background = $gU->Background;
if (empty($Background)) {
$Background = "Transparent.png";
}
$Eyes = $gU->Eyes;
if (empty($Eyes)) {
$Eyes = "Transparent.png";
}
$Mouth = $gU->Mouth;
if (empty($Mouth)) {
$Mouth = "Transparent.png";
}
$Hair = $gU->Hair;
if (empty($Hair)) {
$Hair = "Transparent.png";
}
$Pants = $gU->Pants;
if (empty($Pants)) {
$Pants = "Transparent.png";
}
$Shirt = $gU->Shirt;
if (empty($Shirt)) {
$Shirt = "Transparent.png";
}
$Hat = $gU->Hat;
if (empty($Hat)) {
$Hat = "Transparent.png";
}
$Shoes = $gU->Shoes;
if (empty($Shoes)) {
$Shoes = "Transparent.png";
}
$Gear = $gU->Gear;
if (empty($Gear)) {
$Gear = "Transparent.png";
}
class StackImage
{
private $image;
private $width;
private $height;
public function __construct($Path)
{
if(!isset($Path) || !file_exists($Path))
return;
$this->image = imagecreatefrompng($Path);
imagesavealpha($this->image, true);
imagealphablending($this->image, true);
$this->width = imagesx($this->image);
$this->height = imagesy($this->image);
}
public function AddLayer($Path)
{
if(!isset($Path) || !file_exists($Path))
return;
$new = imagecreatefrompng($Path);
imagesavealpha($new, true);
imagealphablending($new, true);
imagecopy($this->image, $new, 0, 0, 0, 0, imagesx($new), imagesy($new));
}
public function Output($type = "image/png")
{
header("Content-Type: {$type}");
imagepng($this->image);
imagedestroy($this->image);
}
public function GetWidth()
{
return $this->width;
}
public function GetHeight()
{
return $this->height;
}
}
$Image = new StackImage("Images/Transparent.png");
$Image->AddLayer("Marketplace/Dir/".$Background."");
$Image->AddLayer("Marketplace/Dir/".$Body."");
$Image->AddLayer("Marketplace/Dir/".$Eyes."");
$Image->AddLayer("Marketplace/Dir/".$Mouth."");
$Image->AddLayer("Marketplace/Dir/".$Pants."");
$Image->AddLayer("Marketplace/Dir/".$Shirt."");
$Image->AddLayer("Marketplace/Dir/".$Hair."");
$Image->AddLayer("Marketplace/Dir/".$Hat."");
$Image->AddLayer("Marketplace/Dir/".$Shoes."");
$Image->AddLayer("Marketplace/Dir/".$Gear."");
#if (time() < $gU->expireTime) {
#$Image->AddLayer("Images/UserOnline.png");
#}
#if ($gU->Premium == 1) {
#$Image->AddLayer("Images/OmegaUser.png");
# }
#$Image->Output();
?>