Exemple #1
0
function graph($name, $w, $h, $bgc, $fgc, $title, $xtitle, $ytitle, $numX, $xTitles, $xValues, $bc)
{
    $top = 15;
    $right = 5;
    $left = 35;
    $bottom = 25;
    $image = ImageCreate($w, $h);
    $cols = colours($image);
    ImageFill($image, 0, 0, $cols[$bgc]);
    drawAxis($image, $w, $h, $cols[$fgc], $top, $right, $left, $bottom);
    drawLines($image, $w, $h, $cols[$fgc], $top, $right, $left, $bottom);
    drawTitles($image, $w, $h, $cols[$fgc], $title, $xtitle, $ytitle);
    drawXLables($image, $w, $h, $right, $left, $cols[$fgc], $numX, $xTitles);
    $max = calcMaxDataItem($xValues, $numX);
    drawYLables($image, $w, $h, $cols[$fgc], $top, $right, $left, $bottom, $max);
    drawData($image, $w, $h, $cols[$bc], $top, $right, $left, $bottom, $numX, $xValues, $max);
    ImageJPEG($image, $name);
    ImageDestroy($image);
}
Exemple #2
0
 * Created by PhpStorm.
 * User: Barbara
 * Date: 05.11.2015
 * Time: 11:00
 */
require '../../framework/modules/mysqlModule.php';
$functionName = filter_input(INPUT_GET, 'functionName');
$storyID = filter_input(INPUT_GET, 'storyID');
$userID = filter_input(INPUT_GET, 'userID');
$localhost = "localhost";
$user = "******";
$pw = "";
$db = "storytelling_platform";
$storyID = findStoryID($storyID, $userID);
if ($functionName == "drawLines") {
    drawLines($storyID);
} else {
    if ($functionName == "drawNodes") {
        drawNodes($storyID);
    } else {
        if ($functionName == "reorderNodes") {
            reorderNodes($localhost, $user, $pw, $db, $storyID);
        } else {
            if ($functionName == "maxChildren") {
                maxChildren($storyID);
            } else {
                if ($functionName == "addNewNode") {
                    addNewNode($localhost, $user, $pw, $db, $storyID);
                } else {
                    if ($functionName == "deleteNode") {
                        deleteNode($localhost, $user, $pw, $db, $storyID);
Exemple #3
0
$_SESSION['CAPTCHA'][$_REQUEST['cid']] = md5(trim($phrase));
//create the image
$img = imagecreatetruecolor(getConfig("CAPTCHA_WIDTH"), getConfig("CAPTCHA_HEIGHT"));
$clr1 = explode(",", getConfig("CAPTCHA_BG_COLOR"));
$clr2 = explode(",", getConfig("CAPTCHA_FONT_COLOR"));
$clr3 = explode(",", getConfig("CAPTCHA_OTHERS_COLOR"));
//set white background color,black text color,grey graphics
$bg_color = imagecolorallocate($img, $clr1[0], $clr1[1], $clr1[2]);
$text_color = imagecolorallocate($img, $clr2[0], $clr2[1], $clr2[2]);
$graphics_color = imagecolorallocate($img, $clr3[0], $clr3[1], $clr3[2]);
//image fill the background
imagefilledrectangle($img, 0, 0, getConfig("CAPTCHA_WIDTH"), getConfig("CAPTCHA_HEIGHT"), $bg_color);
//draw pass phrase
imagettftext($img, getConfig("CAPTCHA_FONTSIZE"), getConfig("CAPTCHA_ANGLE"), getConfig("CAPTCHA_OFFSET"), getConfig("CAPTCHA_HEIGHT") - 6, $text_color, $font, $phrase);
drawDots($img, $graphics_color);
drawLines($img, $graphics_color);
drawCircles($img, $graphics_color);
// prevent client side  caching
header("Expires: Wed, 1 Jan 1997 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Content-Transfer-Encoding: binary");
header("Pragma: no-cache");
header("Content-type:image/png");
imagepng($img);
imagedestroy($img);
//clean up memory
ob_flush();
exit;
function drawDots($img, $graphics_color)