Ejemplo n.º 1
0
function divingStandings(&$canvas, $geo)
{
    $geo['w'] = 1200;
    $geo['x'] = 360;
    $sort = $geo['sort'];
    $team = $geo['team'];
    $limit = $geo['limit'];
    $offset = $geo['offset'];
    $dir = $geo['sortDirection'];
    $sort = $geo['sort'];
    if ($geo['numericalSort'] == 'true') {
        $sort = '(0 + ' . $sort . ')';
    }
    if ($team == 'ecac') {
        $team = "rpi-mh,dart-mh,yale-mh,union-mh,clark-mh,brown-mh,colgate-mh,quin-mh,stl-mh,prin-mh,cornell-mh,harvard-mh";
        $teamarray = explode(',', $team);
        $finalteamstring = "";
        foreach ($teamarray as $strval) {
            $finalteamstring = $finalteamstring . "`team`='" . trim($strval) . "' OR ";
        }
        $finalteamstring = substr($finalteamstring, 0, -4);
        $sql = "SELECT * FROM `players` WHERE NOT `pos`='G' AND (" . $finalteamstring . ") ORDER BY " . $sort . " " . $dir . " LIMIT " . $offset . ',' . $limit;
    } else {
        if (strpos($team, ',') !== false) {
            $teamarray = explode(',', $team);
            $finalteamstring = "";
            foreach ($teamarray as $strval) {
                $finalteamstring = $finalteamstring . "`team`='" . trim($strval) . "' OR ";
            }
            $finalteamstring = substr($finalteamstring, 0, -4);
            $sql = "SELECT * FROM `players` WHERE NOT `pos`='G' AND (" . $finalteamstring . ") ORDER BY " . $sort . " " . $dir . " LIMIT " . $offset . ',' . $limit;
        } else {
            $sql = "SELECT * FROM players WHERE `team`='" . $team . "' ORDER BY " . $sort . " " . $dir . " LIMIT " . $offset . ',' . $limit;
        }
    }
    $result = dbQuery($sql);
    $players = [];
    while ($row = mysql_fetch_assoc($result)) {
        $players[] = $row;
    }
    $rowHeight = 60;
    $height = count($players) * $rowHeight;
    $yLocation = 1080 - $height - 50;
    $yOffset = $yLocation;
    blackBox($canvas, array('x' => $geo['x'], 'w' => $geo['w'], 'y' => $yLocation - 65, 'h' => $height + 65));
    slantRectangle($canvas, array('x' => $geo['x'] + 200, 'y' => $yLocation - 60, 'w' => 800, 'h' => 50, 'color' => '#333333'));
    shadowText($canvas, array('x' => $geo['x'] + 220, 'y' => $yLocation - 55, 'gravity' => 'center', 'w' => 760, 'h' => 40, 'text' => $geo['roundText'], 'font' => 'fontN', 'color' => 'white'));
    slantRectangle($canvas, array('x' => $geo['x'] - 35, 'y' => $yLocation - 130, 'w' => 1270, 'h' => 70, 'color' => 'red'));
    shadowText($canvas, array('x' => $geo['x'], 'y' => $yLocation - 125, 'gravity' => 'center', 'w' => 1200, 'h' => 60, 'text' => $geo['titleText'], 'font' => 'fontN', 'color' => 'white'));
    shadowText($canvas, array('x' => $geo['x'] + 1030, 'y' => $yLocation - 50, 'gravity' => 'east', 'w' => 150, 'h' => 50, 'text' => $geo['labelText'], 'font' => 'fontN', 'color' => 'white'));
    $place = $offset;
    foreach ($players as $player) {
        $place++;
        $team = array();
        if ($player['stype'] == 'dive') {
            $team = fetchOrg($player['pos']);
        } else {
            $team = fetchTeam($player['team']);
        }
        if ($geo['hideRankColumn'] == 'false') {
            shadowText($canvas, array('x' => $geo['x'], 'y' => $yOffset, 'gravity' => 'east', 'w' => 65, 'h' => $rowHeight, 'text' => $place, 'font' => 'fontN', 'color' => 'white'));
        }
        placeImage($canvas, array('x' => $geo['x'] + 75, 'y' => $yOffset, 'w' => 65, 'h' => $rowHeight, 'path' => $team['logo']));
        shadowText($canvas, array('x' => $geo['x'] + 150, 'y' => $yOffset, 'gravity' => 'west', 'w' => 425, 'h' => $rowHeight, 'text' => $player['first'] . ' ' . $player['last'], 'font' => 'fontN', 'color' => 'white'));
        shadowText($canvas, array('x' => $geo['x'] + 585, 'y' => $yOffset + 4, 'gravity' => 'west', 'w' => 485, 'h' => $rowHeight - 8, 'text' => $team['name'], 'font' => 'fontN', 'color' => 'white'));
        if ($geo['hideLastColumn'] == 'false') {
            shadowText($canvas, array('x' => $geo['x'] + 1080, 'y' => $yOffset, 'gravity' => 'east', 'w' => 100, 'h' => $rowHeight, 'text' => $player[$geo['sort']], 'font' => 'fontN', 'color' => 'white'));
        }
        $yOffset += $rowHeight;
    }
}
Ejemplo n.º 2
0
include "imagick_include.php";
$id = $_GET["id"];
$result = dbquery("SELECT * from titles where id=\"{$id}\" LIMIT 1;");
$titleRow = mysql_fetch_array($result);
$template_id = $titleRow["template"];
$result = dbquery("SELECT * from templates where id=\"{$template_id}\" LIMIT 1;");
$templateRow = mysql_fetch_array($result);
$templateXML = fopen($templateRow["path"], "r");
$contents = stream_get_contents($templateXML);
$canvas = new Imagick();
$canvas->newImage(1920, 1080, "none", "png");
$xml = new SimpleXMLElement($contents);
if ($xml->geo->blackBox) {
    foreach ($xml->geo->blackBox as $box) {
        $l = dbFetch($id, $box);
        blackBox($canvas, $l["x"], $l["y"], $l["w"], $l["h"]);
    }
}
if ($xml->geo->slantRectangle) {
    foreach ($xml->geo->slantRectangle as $slantRectangle) {
        $sR = dbFetch($id, $slantRectangle);
        slantRectangle($canvas, $sR["x"], $sR["y"], $sR["w"], $sR["h"], $sR["color"]);
    }
}
if ($xml->overlay->shadowText) {
    foreach ($xml->overlay->shadowText as $text) {
        $t = dbFetch($id, $text);
        shadowedText($canvas, $t["x"], $t["y"], $t["w"], $t["h"], $t["text"], $t["gravity"], $t["font"], $t["color"]);
    }
}
if ($xml->overlay->plainText) {
Ejemplo n.º 3
0
<?php

include "include.php";
include "imagick_include.php";
$name = $_GET["name"];
$id = $_GET["id"];
$type = $_GET["type"];
$attr = dbFetchAll($id, $name, $type);
//print_r($attr);
$canvas = new Imagick();
$canvas->newImage($attr["w"] + 20, $attr["h"] + 30, "none", "png");
if ($type == "slantRectangle") {
    slantRectangle($canvas, 10, 10, $attr["w"], $attr["h"], $attr["color"]);
} else {
    if ($type == "blackBox") {
        blackBox($canvas, 10, 10, $attr["w"], $attr["h"]);
    } else {
        if ($type == "plainText") {
            plainText($canvas, 10, 10, $attr["w"], $attr["h"], $attr["text"], $attr["gravity"], $attr["font"], $attr["color"]);
        } else {
            if ($type == "shadowText") {
                shadowedText($canvas, 10, 10, $attr["w"], $attr["h"], $attr["text"], $attr["gravity"], $attr["font"], $attr["color"]);
            } else {
                if ($type == "placeImage") {
                    placeImage($canvas, 10, 10, $attr["w"], $attr["h"], $attr["path"]);
                }
            }
        }
    }
}
header("Content-Type: image/png");