Beispiel #1
0
<?php

require '../topi.lib.min';
// Create panel
$panel = new \TopiLib\TopiPanel('png', 9, 100, 170, 190);
$panel->createBlank(500, 500);
// Add image to panel
$img = new \TopiLib\TopiImage(dirname(__FILE__) . './p1.png', 'png');
$img->startX = 91;
$img->startY = 301;
$panel->addImage($img);
$img = new \TopiLib\TopiImage(dirname(__FILE__) . './p2.png', 'png');
$img->startX = 90;
$img->startY = 178;
$panel->addImage($img);
$img = new \TopiLib\TopiImage(dirname(__FILE__) . './p3.png', 'png');
$img->startX = 90;
$img->startY = 95;
$panel->addImage($img);
$img = new \TopiLib\TopiImage(dirname(__FILE__) . './p4.png', 'png');
$img->startX = 195;
$img->startY = 98;
$panel->addImage($img);
$img = new \TopiLib\TopiImage(dirname(__FILE__) . './p5.png', 'png');
$img->startX = 170;
$img->startY = 200;
$panel->addImage($img);
$img = new \TopiLib\TopiImage(dirname(__FILE__) . './p6.png', 'png');
$img->startX = 200;
$img->startY = 282;
$panel->addImage($img);
Beispiel #2
0
    $_SESSION['_CAPTCHA']['config'] = serialize($captcha_config);
    return array('code' => $captcha_config['code'], 'image_src' => $image_src);
}
// Draw the image
if (isset($_GET['_CAPTCHA'])) {
    session_start();
    $captcha_config = unserialize($_SESSION['_CAPTCHA']['config']);
    if (!$captcha_config) {
        exit;
    }
    unset($_SESSION['_CAPTCHA']);
    // Use milliseconds instead of seconds
    srand(microtime() * 100);
    require '../topi.lib.min';
    // Create panel
    $panel = new \TopiLib\TopiPanel('jpeg', 60, 255, 255, 255);
    $panel->txtLMagicMagnet = true;
    $panel->txtTMagicMagnet = true;
    $panel->txtRMagicMagnet = true;
    $panel->txtBMagicMagnet = true;
    $panel->txtLMagicMagnetTol = 10;
    $panel->createBlank(300, 200);
    // Pick random background, get info, and start captcha
    $background = $captcha_config['backgrounds'][rand(0, count($captcha_config['backgrounds']) - 1)];
    $image = new \TopiLib\TopiImage($background, 'png');
    $image->position = 'tile';
    $panel->addImage($image);
    // Determine text angle
    $angle = rand($captcha_config['angle_min'], $captcha_config['angle_max']) * (rand(0, 1) == 1 ? -1 : 1);
    // Select font randomly
    $font = $captcha_config['fonts'][rand(0, count($captcha_config['fonts']) - 1)];
Beispiel #3
0
<?php

require '../topi.lib.min';
// Create panel
$panel = new \TopiLib\TopiPanel('png transparent', 9, 0, 0, 0);
$panel->createFromPNG('./body.png');
// Add image to panel
$img = new \TopiLib\TopiImage(dirname(__FILE__) . './stamps.png', 'png');
$img->startX = 270;
$img->startY = 35;
$panel->addImage($img);
// Add styled text to panel
$txt = new \TopiLib\TopiText('../font.ttf', 'Mr. Hadi Abdi Khojasteh', 1, 25, 18, 18);
$txt->startX = 50;
$txt->startY = 115;
$panel->addText($txt);
$txt = new \TopiLib\TopiText('../font.ttf', 'Azadi Ave, #215', 1, 25, 18, 18);
$txt->startX = 50;
$txt->startY = 140;
$panel->addText($txt);
$txt = new \TopiLib\TopiText('../font.ttf', 'Tehran, Tehran, 32000', 1, 25, 18, 18);
$txt->startX = 50;
$txt->startY = 165;
$panel->addText($txt);
$txt = new \TopiLib\TopiText('../font.ttf', 'I.R.IRAN', 1, 25, 18, 18);
$txt->startX = 50;
$txt->startY = 190;
$panel->addText($txt);
$txt = new \TopiLib\TopiText('../font.ttf', 'Envelope Sample - Topi Lib - version 1.3.1', 1, 60, 12, 36);
$txt->startX = 50;
$txt->startY = 250;