

Moderator: General Moderators


cool cool thanks thanksMcInfo wrote:PHP Manual:
Code: Select all
$id = mysql_real_escape_string($_GET['id']);
//paperdoll parts
$result = mysql_query("SELECT dolltype, dollfname FROM paperdolling WHERE id='$id'") or die(mysql_error());
$paperdoll = mysql_fetch_object($result);
//session var
$_SESSION[$paperdoll->dolltype] = $paperdoll->dollfname;
//fix body
if(isset($_SESSION['Body']))
{
$im = imagecreatefrompng("data/paperdoll/" . $_SESSION['Body']);
$rgb = imagecolorat($im, 1, 1);
imagecolortransparent($im, $rbg);
}
//fix head
if(isset($_SESSION['Head']))
{
//if body is set, merge body and head
if(isset($_SESSION['Body']))
{
//load head
$head = imagecreatefrompng("data/paperdoll/" . $_SESSION['Head']);
$rgb = imagecolorat($head, 1, 1);
imagecolortransparent($head, $rbg);
// Copy and merge
imagecopymerge($im, $head, 0, 0, 0, 0, imagesx($im), imagesy($im), 25);
}
else
{
//load head
$im = imagecreatefrompng("data/paperdoll/" . $_SESSION['Head']);
$rgb = imagecolorat($im, 1, 1);
imagecolortransparent($im, $rbg);
}
}
//fix hair
if(isset($_SESSION['Hair']))
{
//if body is set, merge body and head
if(isset($_SESSION['Body']) || isset($_SESSION['Head']) )
{
//load hair
$hair = imagecreatefrompng("data/paperdoll/" . $_SESSION['Hair']);
$rgb = imagecolorat($hair, 1, 1);
imagecolortransparent($hair, $rbg);
// Copy and merge
imagecopymerge($im, $hair, 0, 0, 0, 0, imagesx($im), imagesy($im), 0);
}
else
{
//load head
$im = imagecreatefrompng("data/paperdoll/" . $_SESSION['Hair']);
$rgb = imagecolorat($im, 1, 1);
imagecolortransparent($im, $rbg);
}
}
//fix clothes
if(isset($_SESSION['Clothes']))
{
//if body is set, merge body and head
if(isset($_SESSION['Body']) || isset($_SESSION['Head']) || isset($_SESSION['Hair']))
{
//load clothes
$clothes= imagecreatefrompng("data/paperdoll/" . $_SESSION['Clothes']);
$rgb = imagecolorat($clothes, 1, 1);
imagecolortransparent($clothes, $rbg);
// Copy and merge
imagecopymerge($im, $clothes, 0, 0, 0, 0, imagesx($im), imagesy($im), 75);
}
else
{
//load clothes
$im = imagecreatefrompng("data/paperdoll/" . $_SESSION['Clothes']);
$rgb = imagecolorat($im, 1, 1);
imagecolortransparent($im, $rbg);
}
}
// Output and free from memory
header('Content-Type: image/png');
imagepng($im);
Code: Select all
$id = mysql_real_escape_string($_GET['id']);
//paperdoll parts
$result = mysql_query("SELECT dolltype, dollfname FROM paperdolling WHERE id='$id'") or die(mysql_error());
$paperdoll = mysql_fetch_object($result);
//session var
$_SESSION[$paperdoll->dolltype] = $paperdoll->dollfname;
//fix body
if(isset($_SESSION['Body']))
{
$im = imagecreatefrompng("data/paperdoll/" . $_SESSION['Body']);
$rgb = imagecolorat($im, 1, 1);
imagecolortransparent($im, $rgb);
}
//fix head
if(isset($_SESSION['Head']))
{
//if body is set, merge body and head
if(isset($_SESSION['Body']))
{
//load head
$head = imagecreatefrompng("data/paperdoll/" . $_SESSION['Head']);
$rgb = imagecolorat($head, 1, 1);
imagecolortransparent($head, $rgb);
// Copy and merge
imagecopymerge($im, $head, 0, 0, 0, 0, imagesx($im), imagesy($im), 75);
}
else
{
//load head
$im = imagecreatefrompng("data/paperdoll/" . $_SESSION['Head']);
$rgb = imagecolorat($im, 1, 1);
imagecolortransparent($im, $rgb);
}
}
//fix hair
if(isset($_SESSION['Hair']))
{
//if body is set, merge body and head
if(isset($_SESSION['Body']) || isset($_SESSION['Head']) )
{
//load hair
$hair = imagecreatefrompng("data/paperdoll/" . $_SESSION['Hair']);
$rgb = imagecolorat($hair, 1, 1);
imagecolortransparent($hair, $rgb);
// Copy and merge
imagecopymerge($im, $hair, 0, 0, 0, 0, imagesx($im), imagesy($im), 75);
}
else
{
//load head
$im = imagecreatefrompng("data/paperdoll/" . $_SESSION['Hair']);
$rgb = imagecolorat($im, 1, 1);
imagecolortransparent($im, $rgb);
}
}
//fix clothes
if(isset($_SESSION['Clothes']))
{
//if body is set, merge body and head
if(isset($_SESSION['Body']) || isset($_SESSION['Head']) || isset($_SESSION['Hair']))
{
//load clothes
$clothes= imagecreatefrompng("data/paperdoll/" . $_SESSION['Clothes']);
$rgb = imagecolorat($clothes, 1, 1);
imagecolortransparent($clothes, $rgb);
// Copy and merge
imagecopymerge($im, $clothes, 0, 0, 0, 0, imagesx($im), imagesy($im), 75);
}
else
{
//load clothes
$im = imagecreatefrompng("data/paperdoll/" . $_SESSION['Clothes']);
$rgb = imagecolorat($im, 1, 1);
imagecolortransparent($im, $rgb);
}
}
// Output and free from memory
header('Content-Type: image/png');
imagepng($im);