Ejemplo n.º 1
0
 protected function paintBackground()
 {
     $this->canvas->fill($this->options['map']['bgColor']);
     if ($this->mapData['backgroundid'] && ($bgImage = get_image_by_imageid($this->mapData['backgroundid']))) {
         $this->canvas->setBgImage($bgImage['image']);
     }
 }
Ejemplo n.º 2
0
 protected function paintBackground()
 {
     $this->canvas->fill($this->options['graphtheme']['backgroundcolor']);
     if ($this->mapData['backgroundid']) {
         $image = get_image_by_imageid($this->mapData['backgroundid']);
         if ($image['image']) {
             $this->canvas->setBgImage($image['image']);
         }
     }
 }
Ejemplo n.º 3
0
function get_png_by_selement($info)
{
    $image = get_image_by_imageid($info['iconid']);
    return $image['image'] ? imagecreatefromstring($image['image']) : get_default_image();
}
Ejemplo n.º 4
0
            $audit_action = 'Image [' . $_REQUEST['name'] . '] added';
        }
        if ($result) {
            add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_IMAGE, $audit_action);
            unset($_REQUEST['form']);
        }
        $result = DBend($result);
        show_messages($result, $msgOk, $msgFail);
    } catch (Exception $e) {
        DBend(false);
        error($e->getMessage());
        show_error_message($msgFail);
    }
} elseif (isset($_REQUEST['delete']) && isset($_REQUEST['imageid'])) {
    DBstart();
    $image = get_image_by_imageid($_REQUEST['imageid']);
    $result = API::Image()->delete([getRequest('imageid')]);
    if ($result) {
        add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_IMAGE, 'Image [' . $image['name'] . '] deleted');
        unset($_REQUEST['form'], $image, $_REQUEST['imageid']);
    }
    $result = DBend($result);
    show_messages($result, _('Image deleted'), _('Cannot delete image'));
}
/*
 * Display
 */
$data = ['form' => getRequest('form')];
if (!empty($data['form'])) {
    if (isset($_REQUEST['imageid'])) {
        $data['imageid'] = $_REQUEST['imageid'];
Ejemplo n.º 5
0
require_once "include/config.inc.php";
require_once "include/images.inc.php";
$page['file'] = 'image.php';
$page['title'] = 'S_IMAGE';
$page['type'] = PAGE_TYPE_IMAGE;
include_once "include/page_header.php";
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array("imageid" => array(T_ZBX_INT, O_MAND, P_SYS, DB_ID, NULL), "width" => array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(1, 2000), NULL), "height" => array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(1, 2000), NULL));
check_fields($fields);
$resize = 0;
if (isset($_REQUEST["width"]) || isset($_REQUEST["height"])) {
    $resize = 1;
    $th_width = get_request('width', 0);
    $th_height = get_request('height', 0);
}
if (!($row = get_image_by_imageid($_REQUEST['imageid']))) {
    error('Incorrect image index');
    include_once "include/page_footer.php";
}
$source = imagecreatefromstring($row['image']);
unset($row);
if ($resize == 1) {
    $src_width = imagesx($source);
    $src_height = imagesy($source);
    if ($src_width > $th_width || $src_height > $th_height) {
        if ($th_width == 0) {
            $th_width = $th_height * $src_width / $src_height;
        } else {
            if ($th_height == 0) {
                $th_height = $th_width * $src_height / $src_width;
            } else {
Ejemplo n.º 6
0
    $images = API::Image()->get(array('filter' => array('imagetype' => IMAGE_TYPE_ICON), 'output' => API_OUTPUT_EXTEND, 'select_image' => 1));
    foreach ($images as $image) {
        $image['image'] = base64_decode($image['image']);
        $ico = imagecreatefromstring($image['image']);
        if ($resize) {
            $ico = imageThumb($ico, $width, $height);
        }
        $w = imagesx($ico);
        $h = imagesy($ico);
        $css .= 'div.sysmap_iconid_' . $image['imageid'] . '{' . ' height: ' . $h . 'px;' . ' width: ' . $w . 'px;' . ' background: url("imgstore.php?iconid=' . $image['imageid'] . '&width=' . $w . '&height=' . $h . '") no-repeat center center;}' . "\n";
    }
    echo $css;
} elseif (isset($_REQUEST['iconid'])) {
    $iconid = get_request('iconid', 0);
    if ($iconid > 0) {
        $image = get_image_by_imageid($iconid);
        $image = $image['image'];
        $source = imageFromString($image);
    } else {
        $source = get_default_image();
    }
    if ($resize) {
        $source = imageThumb($source, $width, $height);
    }
    imageOut($source);
} elseif (isset($_REQUEST['imageid'])) {
    $imageid = get_request('imageid', 0);
    session_start();
    if (isset($_SESSION['image_id'][$imageid])) {
        echo $_SESSION['image_id'][$imageid];
        unset($_SESSION['image_id'][$imageid]);
Ejemplo n.º 7
0
function get_png_by_selement($selement, $info)
{
    switch ($info['icon_type']) {
        case SYSMAP_ELEMENT_ICON_ON:
            $info['iconid'] = $selement['iconid_on'];
            break;
        case SYSMAP_ELEMENT_ICON_UNKNOWN:
            $info['iconid'] = $selement['iconid_unknown'];
            break;
        case SYSMAP_ELEMENT_ICON_MAINTENANCE:
            $info['iconid'] = $selement['iconid_maintenance'];
            break;
        case SYSMAP_ELEMENT_ICON_DISABLED:
            $info['iconid'] = $selement['iconid_disabled'];
            break;
        case SYSMAP_ELEMENT_ICON_OFF:
        default:
            // element image
            $info['iconid'] = $selement['iconid_off'];
            break;
    }
    // Process for default icons
    if ($info['iconid'] == 0) {
        $info['iconid'] = $selement['iconid_off'];
    }
    //------
    $image = get_image_by_imageid($info['iconid']);
    if (!$image) {
        return get_default_image(true);
    }
    return imagecreatefromstring($image['image']);
}
Ejemplo n.º 8
0
$colors['Red'] = imagecolorallocate($im, 255, 0, 0);
$colors['Dark Red'] = imagecolorallocate($im, 150, 0, 0);
$colors['Green'] = imagecolorallocate($im, 0, 255, 0);
$colors['Dark Green'] = imagecolorallocate($im, 0, 150, 0);
$colors['Blue'] = imagecolorallocate($im, 0, 0, 255);
$colors['Dark Blue'] = imagecolorallocate($im, 0, 0, 150);
$colors['Yellow'] = imagecolorallocate($im, 255, 255, 0);
$colors['Dark Yellow'] = imagecolorallocate($im, 150, 150, 0);
$colors['Cyan'] = imagecolorallocate($im, 0, 255, 255);
$colors['Black'] = imagecolorallocate($im, 0, 0, 0);
$colors['Gray'] = imagecolorallocate($im, 150, 150, 150);
$colors['White'] = imagecolorallocate($im, 255, 255, 255);
$x = imagesx($im);
$y = imagesy($im);
imagefilledrectangle($im, 0, 0, $width, $height, $white);
if ($db_image = get_image_by_imageid($backgroundid)) {
    $back = imagecreatefromstring($db_image['image']);
    imagecopy($im, $back, 0, 0, 0, 0, imagesx($back), imagesy($back));
} else {
    $x = imagesx($im) / 2 - ImageFontWidth(4) * strlen($name) / 2;
    imagestring($im, 4, $x, 1, $name, $darkred);
}
unset($db_image);
$str = date('m.d.Y H:i:s', time(NULL));
imagestring($im, 0, imagesx($im) - 120, imagesy($im) - 12, $str, $gray);
if (!isset($_REQUEST['noedit'])) {
    $grid = 50;
    for ($x = $grid; $x < $width; $x += $grid) {
        MyDrawLine($im, $x, 0, $x, $height, $black, MAP_LINK_DRAWTYPE_DASHED_LINE);
        imagestring($im, 2, $x + 2, 2, $x, $black);
    }
Ejemplo n.º 9
0
function get_png_by_selementid($selementid)
{
    $elements = DBselect("select * FROM sysmaps_elements WHERE selementid={$selementid}");
    if (!$elements) {
        return FALSE;
    }
    $element = DBfetch($elements);
    if (!$element) {
        return FALSE;
    }
    $info = get_info_by_selementid($element["selementid"]);
    $image = get_image_by_imageid($info['iconid']);
    if (!$image) {
        return FALSE;
    }
    return imagecreatefromstring($image['image']);
}