function recusiveFolder($folder, $first = false, $name = "") { global $_options; global $_type; $excluse = array(".", "..", ".svn", ".csv", ".git"); if ($first) { $_options = array(); $_options[] = "<option value='{$folder}' style='font-weight:bold'>{$name}</option>"; clearstatcache(); } if ($handle = opendir($folder)) { while ($file = readdir($handle)) { if (!in_array($file, $excluse)) { if (is_dir($folder . $file)) { if ($first) { $_options[] = "<option value='" . replaceValue($folder . $file) . "'>" . printSpace(3) . $file . "</option>"; } recusiveFolder($folder . $file . DS, false); } else { if (substr($file, strrpos($file, '.') + 1) == $_type) { $size = calculateSize(filesize($folder . $file)); $_options[] = "<option value='" . replaceValue($folder . $file) . "'>" . printSpace(9) . $file . " [{$size}]</option>"; } } } } closedir($handle); } }
function thumbnails($img, $w, $h, $dir, $size, $ex) { global $base; require_once $base['dir'] . 'source/thumb/ThumbLib.inc.php'; $thumb = PhpThumbFactory::create($img); $thumb->resize(180, 180); $text = $w . "x" . $h . " " . calculateSize($size) . " " . substr($ex, 1) . ' ' . $base['config']['sitename']; if ($w >= $h) { $thumb->writestr($text, $h * $per / 100); } else { $thumb->writestrup($text, $w * $per / 100); } $thumb->save($dir); chmod($dir, 0777); }
$hours['text'] = dbGetHoursForTeam($TID); $hours['pos']['x'] = 132; $hours['pos']['y'] = 114; $hours['boundary']['side'] = 'left'; $hours['boundary']['x'] = 34 + $padding; // "Outreaches" settings $outreaches['text'] = dbGetNumOutreachForTeam($TID); $outreaches['pos']['x'] = 351; $outreaches['pos']['y'] = 114; $outreaches['boundary']['side'] = 'right'; $outreaches['boundary']['x'] = 446 - $padding; ob_clean(); // ensure output is clean before adding header header('Content-Type: image/png'); $sizeOne = calculateSize($outreaches['text'], $font, $outreaches['pos'], $outreaches['boundary']); $sizeTwo = calculateSize($hours['text'], $font, $hours['pos'], $hours['boundary']); // the numbers should be the same size, so find the smallest $font['size'] = min(array($sizeOne, $sizeTwo)); // determine where the bottom left corner of the hours text should start $hours['offset'] = calculateOffset($hours['text'], $font, $hours['pos']); // add the text imagettftext($image, $font['size'], $font['angle'], $hours['offset']['x'], $hours['offset']['y'], $font['color'], $font['file'], $hours['text']); // determine where the bottom left corner of the text should start $outreaches['offset'] = calculateOffset($outreaches['text'], $font, $outreaches['pos']); // add the number of outreaches imagettftext($image, $font['size'], $font['angle'], $outreaches['offset']['x'], $outreaches['offset']['y'], $font['color'], $font['file'], $outreaches['text']); // display the final image imagepng($image); function calculateSize($text, $font, $pos, $boundary) { // create new variables to avoid modifying arguments