Beispiel #1
0
<?php

require_once 'patterns/NumberImage.php';
echo "Run drawLine.php!";
drawLine();
echo '<img src="simpletext.png"/>';
echo '<img src="jedan.png"/>';
function drawLine()
{
    //header('Content-type: image/png');
    $png_image = imagecreate(150, 150);
    imagecolorallocate($png_image, 15, 142, 210);
    imagesetthickness($png_image, 5);
    $black = imagecolorallocate($png_image, 0, 0, 0);
    $x = 0;
    $y = 0;
    $w = imagesx($png_image) - 1;
    $z = imagesy($png_image) - 1;
    // Rectangle
    // imageline ($image, $x1, $y1, $x2, $y2, $color)
    imageline($png_image, $x, $y, $x, $y + $z, $black);
    imageline($png_image, $x, $y, $x + $w, $y, $black);
    imageline($png_image, $x + $w, $y, $x + $w, $y + $z, $black);
    imageline($png_image, $x, $y + $z, $x + $w, $y + $z, $black);
    // Lines
    imageline($png_image, $x, $y, $w, $z, $black);
    imagepng($png_image, 'simpletext.png');
    //imagepng($png_image);
    imagedestroy($png_image);
    $imgNumber = new NumberImage(1, 50, 50, 10);
    $imgNumber->setFileName("jedan");
Beispiel #2
0
    echo PHP_EOL . boxMsgCenter("{$o2s} info", "|", $bS) . PHP_EOL;
    drawLine($line_len, "=");
    echo PHP_EOL . PHP_EOL;
    if ($ainfo) {
        echo $ainfo . PHP_EOL;
    } else {
        if (count($scanner->files) > 1) {
            if (isset($output) && $output != '') {
                echo $output_head . $output;
            } else {
                echo "nothing found";
            }
        } else {
            echo "Permissions: {$perms}" . PHP_EOL;
            echo "Owner      : {$owner}" . PHP_EOL;
            echo "Group      : {$group}" . PHP_EOL;
            echo "Type       : {$type}" . PHP_EOL;
            echo "Size       : {$size}" . PHP_EOL;
            drawLine(40, "=");
            echo PHP_EOL;
            echo "FOUND" . PHP_EOL;
            if ($found == '') {
                echo 'nothing found' . PHP_EOL;
            } else {
                echo $found . PHP_EOL;
            }
        }
    }
    echo PHP_EOL . PHP_EOL;
    echo "v{$version} by George Dimitrakopoulos 2015" . PHP_EOL;
}
function plotPoints(&$im, $w, $h, $startPadding, $endPadding, $yAxis, $minY, $maxY, $xDivisions, $yDivisions, $lineColor, $xAxisEndPadding)
{
    $x1 = $startPadding;
    $xMod = ($w - $xAxisEndPadding - $startPadding) / $xDivisions;
    for ($i = 0; $i < count($yAxis); $i++) {
        $y1 = $h - $startPadding - ($h - 2 * $startPadding) * ($yAxis[$i] - $minY) / ($maxY - $minY);
        drawPoint($im, $x1, $y1, $lineColor);
        if ($i + 1 < count($yAxis)) {
            $x2 = $x1 + $xMod;
            $y2 = $h - $startPadding - ($h - 2 * $startPadding) * ($yAxis[$i + 1] - $minY) / ($maxY - $minY);
            drawLine($im, $x1, $y1, $x2, $y2, $lineColor);
        }
        $x1 += $xMod;
    }
}
Beispiel #4
0
                receipt += "<?php 
            echo printLine(product_name($row->product_name) . ($row->variant ? ' (' . $row->variant . ')' : '') . ":" . $row->tax_code, '*');
            ?>
" + "\n";
                receipt += "<?php 
            echo printLine($this->sma->formatNumber($row->quantity) . "x" . $this->sma->formatMoney($row->net_unit_price + $row->item_tax / $row->quantity) . ":  " . $this->sma->formatMoney($row->subtotal), ' ') . "";
            ?>
" + "\n";
                receipt += "<?php 
            $r++;
        }
        ?>
";
                receipt += "\x1B\x61\x31";
                receipt += "<?php 
        echo drawLine();
        ?>
\r\n";
                receipt += "\x1B\x61\x30";
                receipt += "<?php 
        echo printLine(lang("total") . ": " . $this->sma->formatMoney($inv->total + $inv->product_tax));
        ?>
" + "\n";
                <?php 
        if ($inv->order_tax != 0) {
            ?>
                receipt += "<?php 
            echo printLine(lang("tax") . ": " . $this->sma->formatMoney($inv->order_tax));
            ?>
" + "\n";
                <?php 
Beispiel #5
0
 public function createPng($doImages = true, $doFill = true, $endTime = null)
 {
     $app = Application::getInstance();
     $im = imagecreatetruecolor(2000, 2000);
     // imageantialias($im,true);
     $white = convertHexColor($im, 'ffffff');
     imagefill($im, 0, 0, $white);
     if (!$doFill) {
         imagecolortransparent($im, $white);
     }
     if ($doImages) {
         $imgArray = array();
         $s = $app->db->prepare("select * from Scribble where DoodleBoardId=:i and type='Image' order by timeCreated asc");
         $s->bindParam(':i', $this->id);
         $s->execute();
         while ($obj = $s->fetchObject()) {
             $tmp = new ImageStruct();
             $tmp->source = $obj->metaData;
             $xData = explode(':', $obj->xCoords);
             $yData = explode(':', $obj->yCoords);
             $tmp->x = $xData[0];
             $tmp->y = $yData[0];
             $tmp->w = array_key_exists('1', $xData) ? $xData[1] : -1;
             $tmp->h = array_key_exists('1', $yData) ? $yData[1] : -1;
             $imgArray[$obj->timeCreated] = $tmp;
         }
         $s = $app->db->prepare("select metaData from Scribble where DoodleBoardId=:i and type='RImage' order by timeCreated asc");
         $s->bindParam(':i', $this->id);
         $s->execute();
         while ($obj = $s->fetchObject()) {
             $id = substr(strrchr($obj->metaData, ":"), 1);
             $imgArray[$id] = null;
         }
         $finalImgArray = array();
         foreach ($imgArray as $key => $img) {
             if ($img != null) {
                 array_push($finalImgArray, array($key, $img));
             }
         }
         $s = $app->db->prepare("select metaData from Scribble where DoodleBoardId=:i and type='FrontImage' order by timeCreated asc");
         $s->bindParam(':i', $this->id);
         $s->execute();
         while ($obj = $s->fetchObject()) {
             $id = substr(strrchr($obj->metaData, ":"), 1);
             $index = getIndex($id, $finalImgArray);
             $temp = $finalImgArray[$index];
             $finalImgArray[$index] = null;
             array_push($finalImgArray, $temp);
         }
         foreach ($finalImgArray as $img) {
             $img = $img[1];
             if ($img != null) {
                 $cpImg = null;
                 $fileName = "/var/www/html/sneffel.com" . $img->source;
                 $ext = substr($img->source, strrpos($img->source, '.') + 1);
                 switch ($ext) {
                     case 'gif':
                         //gif
                         $cpImg = imagecreatefromgif($fileName);
                         break;
                     case 'jpeg':
                         //jpeg
                         $cpImg = imagecreatefromjpeg($fileName);
                         break;
                     case 'jpg':
                         //jpeg
                         $cpImg = imagecreatefromjpeg($fileName);
                         break;
                     case 'pgn':
                         //png
                         $cpImg = imagecreatefrompng($fileName);
                         break;
                 }
                 if ($img->w == -1) {
                     $img->w = imagesx($cpImg);
                 }
                 if ($img->h == -1) {
                     $img->h = imagesy($cpImg);
                 }
                 imagecopyresampled($im, $cpImg, $img->x, $img->y, 0, 0, $img->w, $img->h, imagesx($cpImg), imagesy($cpImg));
                 imagedestroy($cpImg);
             }
         }
     }
     if ($endTime) {
         $s = $app->db->prepare("select * from Scribble where DoodleBoardId=:i and (type='Draw' or type='Erase') and serverTimeCreated <= :end order by serverTimeCreated asc");
         $s->bindParam(':end', $endTime);
         $s->bindParam(':i', $this->id);
         $s->execute();
     } else {
         $s = $app->db->prepare("select * from Scribble where DoodleBoardId=:i and (type='Draw' or type='Erase') order by serverTimeCreated asc");
         $s->bindParam(':i', $this->id);
         $s->execute();
     }
     while ($obj = $s->fetchObject()) {
         $xData = explode(':', $obj->xCoords);
         $yData = explode(':', $obj->yCoords);
         $obj->color = substr(dechex($obj->color + hexdec('FF000000')), 2);
         $color = $obj->type == 'Erase' ? $white : convertHexColor($im, $obj->color);
         for ($i = 0; $i < count($xData) - 1; $i++) {
             if ($xData[$i] != -1 && $xData[$i + 1] != -1) {
                 drawLine($im, $xData[$i], $yData[$i], $xData[$i + 1], $yData[$i + 1], $obj->width - 1, $color);
             }
         }
     }
     return $im;
 }
Beispiel #6
0
 function drawSingleAxis($angle)
 {
     global $SCALE, $dx, $dy;
     $x2 = 2 * $SCALE * cos($angle) + $dx;
     $y2 = 2 * $SCALE * sin($angle) + $dy;
     drawLine($dx, $dy, $x2, $y2);
 }
Beispiel #7
0
 /**
  * Create the HTML for the step
  */
 function _draw()
 {
     global $lang;
     echo tableStart();
     echo '<td colspan="">' . drawSpacer(5, 5) . '</td>';
     tr();
     echo '<td colspan="3" class="informationheader">' . $this->parent->titleText . '</td>';
     tr();
     echo '<td colspan="3">' . drawSpacer(12, 12) . '</td>';
     tr();
     echo '<td colspan="3" class="headbox">';
     echo '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>';
     echo '<td width="70%"><b>' . drawSpacer(10, 10) . $this->title . '</b></td>';
     echo '<td width="30%" align="right"><b>' . $lang->get("step", "Step") . " " . $this->parent->displayStep . " " . $lang->get('of') . " " . count($this->parent->container) . drawSpacer(10, 10) . '</b></td>';
     echo '</tr></table></td>';
     tr();
     echo '<td colspan="3">' . drawSpacer(10, 10) . '</td>';
     tr();
     echo '<td width="45%" valign="top" class="informationheader">' . $this->explanation . '</td>';
     echo '<td width="20">' . drawSpacer(20, 250) . '</td>';
     echo '<td width="50%" valign="top" class="standardlight">';
     echo tableStart();
     for ($i = 0; $i < count($this->container); $i++) {
         $this->container[$i]->draw();
         tr();
     }
     echo "<td>" . drawSpacer(5) . "</td>";
     tr();
     echo '<td>' . $this->addDrawString . '</td>';
     echo tableEnd();
     echo '</td>';
     tr();
     echo '<td colspan="3">' . drawSpacer(10) . drawLine(590) . '</td>';
     tr();
     echo tableEnd();
 }