I need help with PHP GD
Posted: Sun Oct 24, 2010 12:56 pm
I am creating a avatar site and I am always having this problem with my PHP code.
It layers just fine if I create the images on my computer and upload them, but if my friend uploads an item and puts it on the avatar just turns blank. The weird thing is if I save the item my friend uploads and open it on my paint.net and save it again and re upload it it will start to work again.
Anyone know why this is happening?
Code: Select all
<?php
require 'connect.php';
$id = mysql_real_escape_string($_GET['id']);
$getuser = mysql_query("SELECT * FROM `users` WHERE `ID` = '$id'");
$row = mysql_fetch_array($getuser);
$check = mysql_num_rows($getuser);
if($check == 0) {
die("Requested user does not exist!");
}
$base = imagecreatefrompng("Images/Avatar/Base/avatar.png");
if($row['hat'] == NULL) {
$hat= imagecreatefrompng("Images/Avatar/Base/blank.png");
} else {
$hat= imagecreatefrompng("Images/Avatar/Items/".$row['hat']."");
}
header('content-type: image/png');
imagecopymerge($base, $hat, 0, 0, 0, 0, 125, 200, 100);
imagepng($base);
?>Anyone know why this is happening?