function DrawElements($TargetNo = ' ', $Name = ' ', $Country = ' ', $Offset = 0) { global $RowBn, $img, $CFG, $TemplateID; $ColBlk = imagecolorallocate($img, 192, 192, 192); // black e sfondo $ColWhi = imagecolorallocate($img, 255, 255, 255); // bianco imagefilledrectangle($img, $RowBn->BnBgX, $RowBn->BnBgY, $RowBn->BnBgW + $RowBn->BnBgX - 1, $RowBn->BnBgH + $RowBn->BnBgY - 1, $ColWhi); //Immagine di Sfondo if (file_exists($file = $CFG->DOCUMENT_PATH . 'TV/Photos/' . $_SESSION['TourCodeSafe'] . '-BackNo-' . $TemplateID . '.jpg') or file_exists($file = $CFG->DOCUMENT_PATH . 'TV/Photos/' . $_SESSION['TourCodeSafe'] . '-BackNo-0.jpg')) { // inserisci immagine di sfondo $sf = imagecreatefromjpeg($file); imagecopyresampled($img, $sf, $RowBn->BnBgX, $RowBn->BnBgY, 0, 0, $RowBn->BnBgW, $RowBn->BnBgH, imagesx($sf), imagesy($sf)); } else { // inserisci un riquadro bianco } //BackNumber if ($RowBn->BnTargetNo & 1) { draw_pip($RowBn->BnTargetNo, $RowBn->BnTnoSize, "99D", $RowBn->BnTnoX, $RowBn->BnTnoY, $RowBn->BnTnoW, $RowBn->BnTnoH, $RowBn->BnTnoColor); } //Atleta if ($RowBn->BnAthlete & 1) { $NameToSend = ($RowBn->BnCapitalFirstName ? strtoupper($Name) : $Name) . ' ' . $Name; draw_pip($RowBn->BnAthlete, $RowBn->BnAthSize, $NameToSend, $RowBn->BnAthX, $RowBn->BnAthY, $RowBn->BnAthW, $RowBn->BnAthH, $RowBn->BnAthColor); } //Societa if ($RowBn->BnCountry & 1) { draw_pip($RowBn->BnCountry, $RowBn->BnCoSize, $Country, $RowBn->BnCoX, $RowBn->BnCoY, $RowBn->BnCoW, $RowBn->BnCoH, $RowBn->BnCoColor); } }
// bianco $ColBlk = imagecolorallocate($img, 192, 192, 192); // black e sfondo imagefilledrectangle($img, 0, 0, $RowBn->Settings["Width"] * 2 - 1, $RowBn->Settings["Height"] * 2 - 1, $ColWhi); //Immagine di Sfondo if (strlen($RowBn->Background) > 0) { // inserisci immagine di sfondo $sf = imagecreatefromstring($RowBn->Background); imagecopyresampled($img, $sf, $RowBn->Settings["IdBgX"] * 2, $RowBn->Settings["IdBgY"] * 2, 0, 0, $RowBn->Settings["IdBgW"] * 2, $RowBn->Settings["IdBgH"] * 2, imagesx($sf), imagesy($sf)); } else { // filetto grigino di contorno imagerectangle($img, 0, 0, $RowBn->Settings["Width"] * 2 - 1, $RowBn->Settings["Height"] * 2 - 1, $ColBlk); } $q = safe_r_sql("select * from IdCardElements where IceTournament={$_SESSION['TourId']} order by IceOrder"); while ($r = safe_fetch($q)) { draw_pip($r); } // Content type header('Content-type: image/png'); imagepng($img); die; function draw_pip($r) { global $img, $ColBlk, $CFG; static $Fonts = array('arial', 'times', 'cour'); $Options = unserialize($r->IceOptions); switch ($r->IceType) { case 'ToLeft': case 'ToRight': case 'ToBottom': $im = $CFG->DOCUMENT_PATH . "TV/Photos/{$_SESSION['TourCodeSafe']}-{$r->IceType}.jpg";