/** * Zmensi fotku pomoci Nette a GD * @param string $file * @param string $newFilename * @param int|null $height * @param int|null $width * @param bool $exact * @param bool $topCut */ function processNette($file, $newFilename, $height, $width, $exact, $topCut) { $image = \Nette\Utils\Image::fromFile($file); $flags = getFlags($exact); if ($width !== null || $height !== null) { if ($topCut && $exact) { // fotka se orezava pouze z vrchu $image->resize($width, $height, \Nette\Utils\Image::FILL)->crop('50%', 0, $width, $height); } else { $image->resize($width, $height, $flags); } } $image->save($newFilename, 100); }
function getTSChannelInfo($ip, $port, $tPort) { $uArray = getTSChannelUsers($ip, $port, $tPort); $pcArray = array(); $ccArray = array(); $thisArray = array(); $listArray = array(); $usedArray = array(); $cArray = getChannels($ip, $port, $tPort); $z = 0; $x = 0; for ($i = 0; $i < count($cArray); $i++) { $innerArray = $cArray[$i]; $listArray[$i] = $innerArray[3]; } sort($listArray); $cArray = newSort($cArray); for ($i = 0; $i < count($listArray); $i++) { for ($j = 0; $j < count($cArray); $j++) { $innArray = $cArray[$j]; if ($innArray[3] == $listArray[$i] and usedID($usedArray, $innArray[0])) { if ($innArray[2] == -1) { $thisArray[0] = $innArray[0]; $thisArray[1] = $innArray[1]; $thisArray[2] = $innArray[2]; $pcArray[$z] = $thisArray; $usedArray[count($usedArray)] = $innArray[0]; $z++; } else { $thisArray[0] = $innArray[0]; $thisArray[1] = $innArray[1]; $thisArray[2] = $innArray[2]; $ccArray[$x] = $thisArray; $usedArray[count($usedArray)] = $innArray[0]; $x++; } } } } $channels = array(); for ($i = 0; $i < count($pcArray); $i++) { $innerArray = $pcArray[$i]; $schannel = array(); for ($j = 0; $j < count($ccArray); $j++) { $innerCCArray = $ccArray[$j]; if ($innerArray[0] == $innerCCArray[2]) { $players = array(); for ($p = 1; $p < count($uArray); $p++) { $innerUArray = $uArray[$p]; if ($innerCCArray[0] == $innerUArray[1]) { $players[] = array('icon' => setUserStatus($innerUArray[12]), 'name' => "<a href=\"#\" class=\"wrapCell\" onclick=\"return load_teamspeak_info(this," . $innerUArray[0] . ",2)\"> " . removeChar($innerUArray[14]) . " (" . setPPriv($innerUArray[11]) . "" . setCPriv($innerUArray[10]) . ") </a>"); } } $schannel[] = array('players' => $players, 'name' => "<a href=\"#\" class=\"wrapCell\" onclick=\"return load_teamspeak_info(this," . $innerCCArray[0] . ",1)\"> " . removeChar($innerCCArray[1]) . " </a>"); } } $players = array(); for ($k = 1; $k < count($uArray); $k++) { $innerUArray = $uArray[$k]; if ($innerArray[0] == $innerUArray[1]) { $players[] = array('icon' => setUserStatus($innerUArray[12]), 'name' => "<a href=\"#\" class=\"wrapCell\" onclick=\"return load_teamspeak_info(this," . $innerUArray[0] . ",2)\"> " . removeChar($innerUArray[14]) . " (" . setPPriv($innerUArray[11]) . "" . setCPriv($innerUArray[10]) . ") </a>"); } } $channels[] = array('subs' => $schannel, 'players' => $players, 'name' => "<a href=\"#\" class=\"wrapCell\" onclick=\"return load_teamspeak_info(this," . $innerArray[0] . ",1)\"> " . removeChar($innerArray[1]) . " " . getFlags($innerArray[0], $ip, $port, $tPort) . "</a>"); } return $channels; }