コード例 #1
0
ファイル: athleteMedal.php プロジェクト: NathanHass/meda.ls
<?php

require "include/include.php";
$athletes = getAthleteData();
foreach ($athletes as &$athlete) {
    if ($athlete["name"] == $_GET["name"]) {
        if (!empty($athlete[$_GET["type"]])) {
            $num = $athlete[$_GET["type"]];
        } else {
            $num = 0;
        }
    }
}
$im = ImageCreateFromPNG("img/" . $_GET['type'] . ".png");
$bg = ImageColorAllocate($im, 255, 255, 255);
$width = 300;
$height = 300;
$text = $num;
$textcolor = ImageColorAllocate($im, 0, 0, 0);
// Font stuff
$font = 'arial.ttf';
$width = strlen($text);
// String length management
switch (strlen($text)) {
    case 1:
        $x = 110;
        break;
    case 2:
        $x = 80;
}
imagettftext($im, 150, 0, $x, 220, $textcolor, $font, $text);
コード例 #2
0
ファイル: athletes.php プロジェクト: NathanHass/meda.ls
<?php

require "include/include.php";
$data = getAthleteData();
$output = array();
foreach ($data as &$dat) {
    if ($dat["location"] == $_GET['place'] && !empty($dat[strtolower($_GET['medal'])])) {
        array_push($output, $dat);
    }
}
foreach ($output as &$person) {
    echo "<p><a href=\"#\" class=\"person\">" . $person["name"] . "</a></p>";
}