die("Invalid Access");
        break;
}
if (array_key_exists("width", $_GET)) {
    $_webcam_width = $_GET["width"];
} else {
    $_webcam_width = 640;
}
if (array_key_exists("stamp", $_GET)) {
    if ($_GET["stamp"] == "0") {
        $_timestamp = false;
    }
}
$_webcam_height = $_webcam_width * $_webcam_size_ratio;
$source = $_webcam . "?cache=" . getRandNumber();
doImage($source, $_webcam_width, $_webcam_height, $_timestamp, $_webcam_name);
function doImage($source, $width, $height, $timestamp = true, $name)
{
    $origImage = getImage($source, $width, $height);
    if (is_null($origImage)) {
        die("Rendering Error");
    }
    $image = resize($origImage, $width, $height);
    $thumb = resize($origImage, 100, 75);
    if ($timestamp) {
        $image = addTimeStamp($image);
    }
    $compression = 75;
    $filepath = "screenshots/";
    $filename = $filepath . $name . "_" . time() . ".jpg";
    $filename_thumb = $filepath . $name . "_" . time() . "_thumb.jpg";
Esempio n. 2
0
    # Apply a mask if it's set
    # Create the mask
    $mask = imagecreatetruecolor(240, 66);
    imagefilledrectangle($mask, 0, 0, 240, 66, alloColor("FFFFFF"));
    # Shadow
    drawText("a", 17, $getUser['r']['username'], alloColor(0, 0, 0, 80), false, NULL, 12, 0, $im);
    # Text in the mask
    drawText("a", 16, $getUser['r']['username'], alloColor("000001"), false, NULL, 12, 0, $mask);
    # Apply the mask
    imageAlphaMask($im, $mask);
}
# Need to turn on alpha again
imagealphablending($im, false);
imagesavealpha($im, true);
# Output the image and quit
doImage();
#~~~~~~~~~~~#
# Functions #
#~~~~~~~~~~~#
# Function for allocating colors (1 required variable, 4 optional variables)
# Returns a color identifier
function alloColor($r, $g = NULL, $b = NULL, $alpha = 0, $image = NULL)
{
    global $im;
    if ($image === NULL) {
        $image = $im;
    }
    if (strlen($r) > 3) {
        # The function is given a hexcode
        $r = preg_replace("/[^0-9A-Fa-f]/", '', $r);
        $rgbArray = array();