Пример #1
0
$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) {
    foreach ($xml->overlay->plainText as $text) {
        $t = dbFetch($id, $text);
        plainText($canvas, $t["x"], $t["y"], $t["w"], $t["h"], $t["text"], $t["gravity"], $t["font"], $t["color"], true);
    }
}
if ($xml->overlay->placeImage) {
Пример #2
0
<?php

include "imagick_include.php";
$fontN = "fonts/GothamNarrow-Bold.otf";
$font = "fonts/Gotham-Bold.ttf";
$fontX = "fonts/GothamXNarrow-Bold.otf";
$east = imagick::GRAVITY_EAST;
$center = imagick::GRAVITY_CENTER;
$west = imagick::GRAVITY_WEST;
$canvas = new Imagick();
$canvas->newImage(1920, 1080, "gray", "png");
slantRectangle($canvas, 630, 330, 710, 60, '#333');
slantRectangle($canvas, 660, 200, 880, 130, '#F00');
slantRectangle($canvas, 360, 180, 380, 230, '#fff');
slantRectangle($canvas, 630, 610, 710, 60, '#333');
slantRectangle($canvas, 660, 480, 880, 130, '#080');
slantRectangle($canvas, 360, 460, 380, 230, '#fff');
slantRectangle($canvas, 365, 930, 500, 50, '#333');
slantRectangle($canvas, 390, 860, 700, 70, '#F00');
header("Content-Type: image/png");
echo $canvas;
Пример #3
0
}
// Check to see if position uses two characters
if ($row["pos"][1]) {
    $positionWidthModifier = 50;
}
if ($row["pos"][0] == 'W') {
    $positionWidthModifier += 20;
}
$canvas = new Imagick();
$canvas->newImage(1920, 1080, "none", "png");
blackbox($canvas, 400, 870 - $boxHeightModifier, 1120, 160 + $boxHeightModifier);
slantRectangle($canvas, 360, 800 - $boxHeightModifier, 780, 80, $tColor);
slantRectangle($canvas, 1100 - $positionWidthModifier, 800 - $boxHeightModifier, 150, 80, "#303030");
slantRectangle($canvas, 1210 - $positionWidthModifier, 800 - $boxHeightModifier, 130 + $positionWidthModifier, 80, $tColor);
slantRectangle($canvas, 1300, 800 - $boxHeightModifier, 140, 80, "#303030");
slantRectangle($canvas, 1400, 800 - $boxHeightModifier, 160, 80, "white");
$pPath = "teams/" . $row["team"] . "imgs/" . $row["first"] . $row["last"] . ".png";
$size = @getimagesize($pPath);
$nameModifier = 0;
$detailsModifier = 0;
if ($size[0]) {
    $pW = 192;
    $pH = 230;
    $pX = 400;
    $pY = 801;
    if ($size[0] * 1.2 > $size[1]) {
        $pH = $size[1] / ($size[0] / $pW);
        $pY += 230 - $pH;
    }
    placeImage($canvas, $pX, $pY, $pW, $pH, $pPath);
} else {
Пример #4
0
if ($row["pos"][0] == 'W') {
    $positionWidthModifier += 20;
}
$blackBox = new Imagick();
$blackBox->newImage(1150, 190, "none", "png");
$mainBar = new Imagick();
$mainBar->newImage(1230, 110, "none", "png");
$logoBox = new Imagick();
$logoBox->newImage(190, 110, "none", "png");
blackbox($blackBox, array('x' => 10, 'y' => 10, 'w' => 1120, 'h' => 160 + $boxHeightModifier));
slantRectangle($mainBar, array('x' => 10, 'y' => 10, 'w' => 780, 'h' => 80, 'color' => $tColor));
slantRectangle($mainBar, array('x' => 750 - $positionWidthModifier, 'y' => 10, 'w' => 150, 'h' => 80, 'color' => "#303030"));
slantRectangle($mainBar, array('x' => 860 - $positionWidthModifier, 'y' => 10, 'w' => 130 + $positionWidthModifier, 'h' => 80, 'color' => $tColor));
slantRectangle($mainBar, array('x' => 950, 'y' => 10, 'w' => 140, 'h' => 80, 'color' => "#303030"));
slantRectangle($mainBar, array('x' => 1050, 'y' => 10, 'w' => 160, 'h' => 80, 'color' => "white"));
slantRectangle($logoBox, array('x' => 10, 'y' => 10, 'w' => 160, 'h' => 80, 'color' => "white"));
$pPath = "teams/" . $row["team"] . "imgs/" . $row["first"] . $row["last"] . ".png";
$size = @getimagesize($pPath);
$nameModifier = 0;
$detailsModifier = 0;
$p = null;
if ($size[0]) {
    $p = array('w' => 192, 'h' => 230, 'x' => 400, 'y' => '801', 'path' => $pPath);
    if ($size[0] * 1.2 > $size[1]) {
        $p['h'] = $size[1] / ($size[0] / $p['w']);
        $p['y'] += 230 - $p['h'];
    }
    //placeImage($canvas, $p);
} else {
    $nameModifier = -150;
    $detailsModifier = -220;
Пример #5
0
<?php

include "imagick_include.php";
$canvas = new Imagick();
$canvas->newImage(700, 60, "none", "png");
//blackBox($canvas,48,130,862,200);
slantRectangle($canvas, 10, 10, 670, 40, '#d00000');
$fontN = "fonts/GothamNarrow-Bold.otf";
$west = imagick::GRAVITY_WEST;
shadowedText($canvas, 45, 15, 600, 30, "Your Imagick install is configured correctly!", "west", "fontN", "white");
header("Content-Type: image/png");
echo $canvas;
Пример #6
0
<?php

include "imagick_include.php";
$canvas = new Imagick();
$canvas->newImage(700, 60, "none", "png");
//blackBox($canvas,48,130,862,200);
slantRectangle($canvas, array('x' => 10, 'y' => 10, 'w' => 670, 'h' => 40, 'color' => '#d00000'));
$fontN = "fonts/GothamNarrow-Bold.otf";
$west = imagick::GRAVITY_WEST;
shadowText($canvas, array('x' => 45, 'y' => 15, 'w' => 600, 'h' => 30, 'text' => "Your Imagick install is configured correctly!", 'gravity' => "west", 'font' => "fontN", 'color' => "white"));
header("Content-Type: image/png");
echo $canvas;
Пример #7
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;
    }
}
Пример #8
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");