Пример #1
0
 function draw($text = "1111111111111")
 {
     $_GET = array('code' => "BCGcode128", 'filetype' => "PNG", 'dpi' => 72, 'scale' => 1, 'rotation' => 0, 'font_family' => "Arial.ttf", 'font_size' => 8, 'text' => $text, 'thickness' => 30);
     $filetypes = array('PNG' => BCGDrawing::IMG_FORMAT_PNG, 'JPEG' => BCGDrawing::IMG_FORMAT_JPEG, 'GIF' => BCGDrawing::IMG_FORMAT_GIF);
     $drawException = null;
     try {
         $color_black = new BCGColor(0, 0, 0);
         $color_white = new BCGColor(255, 255, 255);
         $code_generated = new BCGcode128();
         if (function_exists('baseCustomSetup')) {
             baseCustomSetup($code_generated, $_GET);
         }
         if (function_exists('customSetup')) {
             customSetup($code_generated, $_GET);
         }
         $code_generated->setScale(max(1, min(4, $_GET['scale'])));
         $code_generated->setBackgroundColor($color_white);
         $code_generated->setForegroundColor($color_black);
         if ($_GET['text'] !== '') {
             $text = convertText($_GET['text']);
             $code_generated->parse($text);
         }
     } catch (Exception $exception) {
         $drawException = $exception;
     }
     $drawing = new BCGDrawing('', $color_white);
     if ($drawException) {
         $drawing->drawException($drawException);
     } else {
         $drawing->setBarcode($code_generated);
         $drawing->setRotationAngle($_GET['rotation']);
         $drawing->setDPI($_GET['dpi'] === 'NULL' ? null : max(72, min(300, intval($_GET['dpi']))));
         $drawing->draw();
     }
     switch ($_GET['filetype']) {
         case 'PNG':
             header('Content-Type: image/png');
             break;
         case 'JPEG':
             header('Content-Type: image/jpeg');
             break;
         case 'GIF':
             header('Content-Type: image/gif');
             break;
     }
     $drawing->finish($filetypes[$_GET['filetype']]);
 }
Пример #2
0
    }
}
$class_dir = 'Codebar';
include_once $class_dir . DIRECTORY_SEPARATOR . 'Barcode.php';
require_once $class_dir . DIRECTORY_SEPARATOR . 'Color.php';
require_once $class_dir . DIRECTORY_SEPARATOR . 'Draw.php';
$drawException = null;
try {
    $color_black = new Color(0, 0, 0);
    $color_white = new Color(255, 255, 255);
    $code_generated = new Barcode();
    $code_generated->setScale(max(1, min(4, $_GET['scale'])));
    $code_generated->setBackgroundColor($color_white);
    $code_generated->setForegroundColor($color_black);
    if ($_GET['text'] !== '') {
        $text = convertText($_GET['text']);
        $code_generated->parse($text);
    }
} catch (Exception $exception) {
    $drawException = $exception;
}
$drawing = new Draw('', $color_white);
if ($drawException) {
    $drawing->drawException($drawException);
} else {
    $drawing->setBarcode($code_generated);
    $drawing->setRotationAngle($_GET['rotation']);
    $drawing->setDPI($_GET['dpi'] === 'NULL' ? null : max(72, min(300, intval($_GET['dpi']))));
    $drawing->draw();
}
header('Content-Type: image/png');
Пример #3
0
$filetype = isset($_POST['filetype']) ? $_POST['filetype'] : $default_value['filetype'];
$dpi = isset($_POST['dpi']) ? $_POST['dpi'] : $default_value['dpi'];
$scale = intval(isset($_POST['scale']) ? $_POST['scale'] : $default_value['scale']);
$rotation = intval(isset($_POST['rotation']) ? $_POST['rotation'] : $default_value['rotation']);
$font_family = isset($_POST['font_family']) ? $_POST['font_family'] : $default_value['font_family'];
$font_size = intval(isset($_POST['font_size']) ? $_POST['font_size'] : $default_value['font_size']);
$text = isset($_POST['text']) ? $_POST['text'] : $default_value['text'];
registerImageKey('filetype', $filetype);
registerImageKey('dpi', $dpi);
registerImageKey('scale', $scale);
registerImageKey('rotation', $rotation);
registerImageKey('font_family', $font_family);
registerImageKey('font_size', $font_size);
registerImageKey('text', stripslashes($text));
// Text in form is different than text sent to the image
$text = convertText($text);
?>


  
                    
                    <?php 
php;
?>
                    
            
     
        <br><br><br>
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-info">
                                <div class="panel-heading">
Пример #4
0
         }
         $resp->redirect('http://twimlets.com/voicemail?Email=' . $config['voicemail_email'] . '&Message=' . $message);
     }
 } elseif ($_SESSION['type'] == 'ticket' || $_REQUEST['type'] == 'ticket') {
     $tid = $_REQUEST['Digits'];
     $d = select_query('tbltickets', 'id', array('tid' => $tid));
     if (!mysql_num_rows($d)) {
         if ($config['step2_ticket_sorry_mode'] == 'text') {
             $resp->say($config['step2_ticket_sorry_text']);
         } else {
             $resp->play('get_audio.php?f=step2_ticket_sorry_file');
         }
         $resp->redirect('call_handler.php');
     } else {
         if ($config['step2_ticket_mode'] == 'text') {
             $say = convertText($config['step2_ticket_text'], 'ticket', $tid);
             $resp->say($say);
         } else {
             $resp->play('get_audio.php?f=step2_ticket_file');
         }
         foreach ($numbers as $key => $number) {
             $resp->dial($number['number'], array('timeout' => $number['timeout']));
         }
         // Send data to node.js to pass along to WHMCS admins
         $ticket = mysql_fetch_assoc($d);
         $data = array('type' => 'ticket', 'ticketid' => $ticket['id']);
         sendData($data, $config['server_port']);
         // Just in case no one answers, forward to VM
         $resp->redirect('http://twimlets.com/voicemail?Email=' . $config['voicemail_email']);
     }
 } else {
Пример #5
0
<?php

define('IN_CB', true);
require_once 'function.php';
registerImageKey('code', 'BCGcode39');
echo convertText('test');