<?php
require_once ('system/func.php');
header('content-type: image/png');
$id = abs(intval($_GET['id']));
if($id)$prof = mysql_fetch_assoc(mysql_query("SELECT * FROM `komplekt` WHERE `id` = '".$id."'"));


$image = imageCreateFromPng('./dummy/things/'.$user['sex'].'/fon.png');


$item_7 = mysql_query("SELECT * FROM `item` WHERE `id_komplekt` = '".$prof['id']."' AND `tip` = 'nogi'");
$item_7 = mysql_fetch_array($item_7);
if($item_7){
$item_7_image = imageCreateFromPng('./dummy/things/'.$item_7['tip'].'/'.$item_7['item'].'.png');
imagecopy($image, $item_7_image, 0, 0, 0, 0, 120, 160);
}

$item_8 = mysql_query("SELECT * FROM `item` WHERE `id_komplekt` = '".$prof['id']."' AND `tip` = 'obuv'");
$item_8 = mysql_fetch_array($item_8);
if($item_8){
$item_8_image = imageCreateFromPng('./dummy/things/'.$item_8['tip'].'/'.$item_8['item'].'.png');
imagecopy($image, $item_8_image, 0, 0, 0, 0, 120, 160);
}

$item_3 = mysql_query("SELECT * FROM `item` WHERE `id_komplekt` = '".$prof['id']."' AND `tip` = 'tors' ORDER BY `id` LIMIT 1");
$item_3 = mysql_fetch_array($item_3);
if($item_3){
$item_3_image = imageCreateFromPng('./dummy/things/'.$item_3['tip'].'/'.$item_3['item'].'.png');
imagecopy($image, $item_3_image, 0, 0, 0, 0, 120, 160);
}

$item_1 = mysql_query("SELECT * FROM `item` WHERE `id_komplekt` = '".$prof['id']."' AND `tip` = 'golova'");
$item_1 = mysql_fetch_array($item_1);
if($item_1){
$item_1_image = imageCreateFromPng('./dummy/things/'.$item_1['tip'].'/'.$item_1['item'].'.png');
imagecopy($image, $item_1_image, 0, 0, 0, 0, 120, 160);
}

$item_2 = mysql_query("SELECT * FROM `item` WHERE `id_komplekt` = '".$prof['id']."' AND `tip` = 'plechi'");
$item_2 = mysql_fetch_array($item_2);
if($item_2){
$item_2_image = imageCreateFromPng('./dummy/things/'.$item_2['tip'].'/'.$item_2['item'].'.png');
imagecopy($image, $item_2_image, 0, 0, 0, 0, 120, 160);
}

$item_4 = mysql_query("SELECT * FROM `item` WHERE `id_komplekt` = '".$prof['id']."' AND `tip` = 'perchatki'");
$item_4 = mysql_fetch_array($item_4);
if($item_4){
$item_4_image = imageCreateFromPng('./dummy/things/'.$item_4['tip'].'/'.$item_4['item'].'.png');
imagecopy($image, $item_4_image, 0, 0, 0, 0, 120, 160);
}

$item_6 = mysql_query("SELECT * FROM `item` WHERE `id_komplekt` = '".$prof['id']."' AND `tip` = 'prav'");
$item_6 = mysql_fetch_array($item_6);
if($item_6){
$item_6_image = imageCreateFromPng('../dummy/things/'.$item_6['tip'].'/'.$item_6['item'].'.png');
imagecopy($image, $item_6_image, 0, 0, 0, 0, 120, 160);
}

$item_5 = mysql_query("SELECT * FROM `item` WHERE `id_komplekt` = '".$prof['id']."' AND `tip` = 'lev'");
$item_5 = mysql_fetch_array($item_5);
if($item_5){
$item_5_image = imageCreateFromPng('./dummy/things/'.$item_5['tip'].'/'.$item_5['item'].'.png');
imagecopy($image, $item_5_image, 0, 0, 0, 0, 120, 160);
}


imagePng($image);
?>