コード例 #1
0
ファイル: swfgen.php プロジェクト: rzel/ajaxanimator
function rgbConvert($str)
{
    //echo($str.strpos($str,","));
    if (strpos($str, ",")) {
        //echo "rgb2array";
        return rgb2array($str);
    } else {
        //echo "hex2rgb";
        return hex2rgb($str);
    }
}
コード例 #2
0
ファイル: horizontalchart.php プロジェクト: pmolfese/nidb
$im = imagecreatetruecolor($w, $h);
/* set background to white */
$bg = imagecolorallocate($im, 255, 255, 255);
imagefilledrectangle($im, 0, 0, $w, $h, $bg);
/* get the pixel sizes of the blocks */
$values = explode(',', $v);
$colors = explode(',', $c);
$sum = array_sum($values);
if ($sum > 0) {
    $x1 = $x2 = 0;
    $y1 = 0;
    $y2 = $h;
    $i = 0;
    foreach ($values as $val) {
        //echo "$colors[$i]<br>";
        list($red, $green, $blue) = rgb2array($colors[$i]);
        //echo "$red, $green, $blue<br>";
        $x1 = $x2;
        $x2 = $x1 + $w * ($val / $sum);
        $color = imagecolorallocate($im, $red, $green, $blue);
        imagefilledrectangle($im, $x1, $y1, $x2, $y2, $color);
        $i++;
        //break;
    }
}
if ($b == "yes") {
    /* draw a gray border */
    $gray = imagecolorallocate($im, 120, 120, 120);
    imagepolygon($im, array(0, 0, 0, $h - 1, $w - 1, $h - 1, $w - 1, 0), 4, $gray);
}
/* send the image to the browser */
コード例 #3
0
ファイル: captcha.php プロジェクト: rjon76/netspotapp
<?php

/*if(substr_count($_SERVER['HTTP_REFERER'],  $_SERVER['HTTP_HOST'])==0) {
	exit;	
}*/
session_start();
$name = isset($_GET['name']) ? $_GET['name'] : 'captcha';
$color = isset($_GET['c']) && $_GET['c'] !== '' ? $_GET['c'] : 'F1F1F1';
$fontcolor = isset($_GET['f']) && $_GET['f'] !== '' ? $_GET['f'] : '000';
function rgb2array($rgb)
{
    return array(base_convert(substr($rgb, 0, 2), 16, 10), base_convert(substr($rgb, 2, 2), 16, 10), base_convert(substr($rgb, 4, 2), 16, 10));
}
$background = rgb2array($color);
$fontcolor = rgb2array($fontcolor);
$count = 5;
/* количество символов */
$width = 100;
/* ширина картинки */
$height = 32;
/* высота картинки */
$font_size_min = 18;
/* минимальная высота символа */
$font_size_max = 22;
/* максимальная высота символа */
$font_file = "./Comic_Sans_MS.ttf";
/* путь к файлу относительно w3captcha.php */
$char_angle_min = -10;
/* максимальный наклон символа влево */
$char_angle_max = 10;
/* максимальный наклон символа вправо */