Example #1
0
function make_captcha_img()
{
    global $CaptchaBGs;
    $Length = 6;
    $ImageHeight = 75;
    $ImageWidth = 300;
    $Chars = 'abcdefghjkmprstuvwxyzABCDEFGHJKLMPQRSTUVWXY23456789';
    $CaptchaString = '';
    for ($i = 0; $i < $Length; $i++) {
        $CaptchaString .= $Chars[mt_rand(0, strlen($Chars) - 1)];
    }
    for ($x = 0; $x < $Length; $x++) {
        $FontDisplay[$x]['size'] = mt_rand(24, 32);
        $FontDisplay[$x]['top'] = mt_rand($FontDisplay[$x]['size'] + 5, $ImageHeight - $FontDisplay[$x]['size'] / 2);
        $FontDisplay[$x]['angle'] = mt_rand(-30, 30);
        $FontDisplay[$x]['font'] = get_font();
    }
    $Img = imagecreatetruecolor($ImageWidth, $ImageHeight);
    $BGImg = imagecreatefrompng(SERVER_ROOT . '/captcha/' . $CaptchaBGs[mt_rand(0, count($CaptchaBGs) - 1)]);
    imagecopymerge($Img, $BGImg, 0, 0, 0, 0, 300, 75, 50);
    $ForeColor = imagecolorallocatealpha($Img, 255, 255, 255, 65);
    for ($i = 0; $i < strlen($CaptchaString); $i++) {
        $CharX = $ImageWidth / $Length * ($i + 1) - $ImageWidth / $Length * 0.75;
        imagettftext($Img, $FontDisplay[$i]['size'], $FontDisplay[$i]['angle'], $CharX, $FontDisplay[$i]['top'], $ForeColor, $FontDisplay[$i]['font'], $CaptchaString[$i]);
    }
    header('Content-type: image/png');
    imagepng($Img);
    imagedestroy($Img);
    return $CaptchaString;
}
function write_graph_legend(&$image, $colours, $width, $height)
{
    $font = get_font();
    $size = 7;
    $angle = 0;
    $title = 'Before';
    $bb = imagettfbbox($size, $angle, $font, $title);
    imagettftext($image, $size, $angle, $width / 2 - ($bb[2] - $bb[0]), $height - 12, $colours->beforepoint, $font, $title);
    $title = 'After';
    $bb = imagettfbbox($size, $angle, $font, $title);
    imagettftext($image, $size, $angle, $width / 2 + ($bb[2] - $bb[0]), $height - 12, $colours->afterpoint, $font, $title);
}
Example #3
0
function be_themes_print_typography($tag)
{
    global $be_themes_data;
    $get_font = get_font($be_themes_data[$tag]['family']);
    if (isset($get_font['weight'])) {
        $weight = $get_font['weight'];
    } else {
        $weight = $be_themes_data[$tag]['weight'];
    }
    if (isset($get_font['style'])) {
        $style = $get_font['style'];
    } else {
        $style = 'normal';
    }
    echo 'font: ' . $style . ' ' . $weight . ' ' . $be_themes_data[$tag]["size"] . ' "' . $get_font["name"] . '","PT Sans Narrow","Arial Narrow",sans-serif; 
  color: ' . $be_themes_data[$tag]["color"] . ';
  line-height: ' . $be_themes_data[$tag]["line_height"] . ';
  text-transform: ' . $be_themes_data[$tag]["transform"] . ';';
}
function be_themes_print_typography_special_heading($tag = 'h1', $size = '13px')
{
    global $be_themes_data;
    $get_font = get_font($be_themes_data[$tag]['family']);
    if (isset($get_font['weight'])) {
        $weight = $get_font['weight'];
    } else {
        $weight = $be_themes_data[$tag]['weight'];
    }
    if (isset($get_font['style'])) {
        $style = $get_font['style'];
    } else {
        $style = 'normal';
    }
    echo 'font: ' . $style . ' ' . $weight . ' ' . $size . ' "' . $get_font["name"] . '","Open Sans","Arial",sans-serif;';
}