当前位置: 首页>>代码示例>>PHP>>正文


PHP hexrgb函数代码示例

本文整理汇总了PHP中hexrgb函数的典型用法代码示例。如果您正苦于以下问题:PHP hexrgb函数的具体用法?PHP hexrgb怎么用?PHP hexrgb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了hexrgb函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 function __construct($x, $y, $r, $b, $c, $f, $m, $e, $s)
 {
     $this->x = $x;
     $this->y = $y;
     $this->r = $r;
     $this->b = $b;
     $this->c = $c;
     $this->f = hexrgb($f);
     $this->m = hexrgb($m);
     $this->e = hexrgb($e);
     $this->s = hexrgb($s);
 }
开发者ID:jefferyyuan,项目名称:RosettaCodeData,代码行数:12,代码来源:maze-generation.php

示例2: overpop

function overpop($t, $id, $clr, $typo, $opac, $w = 320, $h = 240)
{
    $randid = randid();
    $ov = 'document.getElementById(\'crt1' . $randid . '\').style.backgroundColor=\'' . hexrgb($clr, 0) . '\'; document.getElementById(\'crt2' . $randid . '\').style.backgroundColor=\'' . hexrgb($clr, 0.9) . '\';';
    $ot = 'document.getElementById(\'crt1' . $randid . '\').style.backgroundColor=\'' . hexrgb($clr, $opac) . '\'; document.getElementById(\'crt2' . $randid . '\').style.backgroundColor=\'' . hexrgb($clr, 1) . '\';';
    $go = is_numeric($id) ? 'href="' . urlread($id) . '"' : atb('onclick', $id);
    //title
    $title = div(' id="crt2' . $randid . '" style="font-family:' . $typo . '; font-size:24px; text-align:center; color:#' . invert_color($clr, 1) . '; padding:10px; width:140px; background-color:#' . $clr . '; margin:100px auto; vertical-align:middle; box-shadow:0 0 5px #' . $clr . '; text-shadow: 0 0 3px #' . invert_color($clr, 0) . ';"', $t);
    // transition: all 1s ease;
    //rideau
    $sty = 'position:absolute; width:' . ($w ? $w : 320) . 'px; height:' . ($h ? $h : 240) . 'px; background-color:' . hexrgb($clr, $opac) . '; text-align-center; vertical-align:middle; transition: all 1s ease; box-shadow:2px 2px 5px ' . hexrgb('000000', 0.5) . '; display:inline-block;';
    $ret = div(' style="' . $sty . '" id="crt1' . $randid . '"', $t ? $title : '');
    $ret = '<a ' . $go . atb('onmouseover', $ov) . atb('onmouseout', $ot) . '>' . $ret . '</a>';
    return $ret;
}
开发者ID:philum,项目名称:cms,代码行数:15,代码来源:overpop.php

示例3: create_image

function create_image()
{
    $APP = get_instance();
    $image_width = 60;
    $image_height = 26;
    $characters_on_image = 4;
    $font = BASEPATH . 'font/utm_olossalis.ttf';
    //The characters that can be used in the CAPTCHA code.
    //avoid confusing characters (l 1 and i for example)
    $possible_letters = '123456789';
    $random_dots = 0;
    $random_lines = 0;
    $captcha_text_color = "0xFFFFFF";
    $captcha_noice_color = "0x249805";
    $code = '';
    $i = 0;
    while ($i < $characters_on_image) {
        $code .= substr($possible_letters, mt_rand(0, strlen($possible_letters) - 1), 1);
        $i++;
    }
    $APP->session->data['mabaove'] = $code;
    $font_size = $image_height * 0.5;
    $image = @imagecreate($image_width, $image_height);
    /* setting the background, text and noise colours here */
    $background_color = imagecolorallocate($image, 36, 152, 5);
    $arr_text_color = hexrgb($captcha_text_color);
    $text_color = imagecolorallocate($image, $arr_text_color['red'], $arr_text_color['green'], $arr_text_color['blue']);
    $arr_noice_color = hexrgb($captcha_noice_color);
    $image_noise_color = imagecolorallocate($image, $arr_noice_color['red'], $arr_noice_color['green'], $arr_noice_color['blue']);
    /* generating the dots randomly in background */
    for ($i = 0; $i < $random_dots; $i++) {
        imagefilledellipse($image, mt_rand(0, $image_width), mt_rand(0, $image_height), 2, 3, $image_noise_color);
    }
    /* generating lines randomly in background of image */
    for ($i = 0; $i < $random_lines; $i++) {
        imageline($image, mt_rand(0, $image_width), mt_rand(0, $image_height), mt_rand(0, $image_width), mt_rand(0, $image_height), $image_noise_color);
    }
    $textbox = imagettfbbox($font_size, 0, $font, $code);
    $x = ($image_width - $textbox[4]) / 2;
    $y = ($image_height - $textbox[5]) / 2;
    imagettftext($image, $font_size, 0, $x, $y, $text_color, $font, $code);
    header('Content-Type: image/png');
    // defining the image type to be shown in browser widow
    imagepng($image);
    //showing the image
    imagedestroy($image);
    //destroying the image instance
}
开发者ID:shyaken,项目名称:maoy.palt,代码行数:48,代码来源:captcha.php

示例4: while

$random_lines = 20;
$captcha_text_color = "0x000000";
$captcha_noice_color = "0x142864";
$code = '';
$i = 0;
while ($i < $characters_on_image) {
    $code .= substr($possible_letters, mt_rand(0, strlen($possible_letters) - 1), 1);
    $i++;
}
$font_size = $image_height * 0.7;
$image = @imagecreate($image_width, $image_height);
/* setting the background, text and noise colours here */
$background_color = imagecolorallocate($image, 255, 255, 255);
$arr_text_color = hexrgb($captcha_text_color);
$text_color = imagecolorallocate($image, $arr_text_color['red'], $arr_text_color['green'], $arr_text_color['green']);
$arr_noice_color = hexrgb($captcha_noice_color);
$image_noise_color = imagecolorallocate($image, $arr_noice_color['red'], $arr_noice_color['green'], $arr_noice_color['green']);
/* generating the dots randomly in background */
for ($i = 0; $i < $random_dots; $i++) {
    imagefilledellipse($image, mt_rand(0, $image_width), mt_rand(0, $image_height), 2, 3, $image_noise_color);
}
/* generating lines randomly in background of image */
for ($i = 0; $i < $random_lines; $i++) {
    imageline($image, mt_rand(0, $image_width), mt_rand(0, $image_height), mt_rand(0, $image_width), mt_rand(0, $image_height), $image_noise_color);
}
/* create a text box and add 6 letters code in it */
$textbox = imagettfbbox($font_size, 0, $font, $code);
$x = ($image_width - $textbox[4]) / 2;
$y = ($image_height - $textbox[5]) / 2;
imagettftext($image, $font_size, 0, $x, $y, $text_color, $font, $code);
/* Show captcha image in the page html page */
开发者ID:joel-medeiros,项目名称:basso,代码行数:31,代码来源:captcha_code_file.php

示例5: affect_rgba

function affect_rgba($d, $clr)
{
    $r = explode('#', $d);
    $n = count($r);
    $clr[0] = '';
    for ($i = 0; $i < $n; $i++) {
        if (substr($r[$i], 0, 1) == '_') {
            $klr = str_until($r[$i], ';,) ');
            $vlr = substr(trim($klr), 1);
            if (strpos($vlr, '.')) {
                list($abs, $alp) = explode('.', $vlr);
                $ret .= str_replace($klr, hexrgb($clr[$abs], $alp / 10), $r[$i]);
            } else {
                $ret .= '#' . str_replace($klr, $clr[$vlr], $r[$i]);
            }
        } elseif ($i) {
            $ret .= '#' . $r[$i];
        } else {
            $ret .= $r[$i];
        }
    }
    return $ret;
}
开发者ID:philum,项目名称:cms,代码行数:23,代码来源:styl.php

示例6: wp_resize_letterbox

function wp_resize_letterbox($src, $w, $h, $color = '#000000')
{
    //$old_file = TimberHelper::get_full_path($src);
    $urlinfo = parse_url($src);
    $old_file = ABSPATH . $urlinfo['path'];
    $new_file = TimberImageHelper::get_letterbox_file_path($urlinfo['path'], $w, $h);
    $new_file_rel = TimberImageHelper::get_letterbox_file_rel($urlinfo['path'], $w, $h);
    $new_file_boxed = str_replace('-lb-', '-lbox-', $new_file);
    if (file_exists($new_file_boxed)) {
        $new_file_rel = str_replace('-lb-', '-lbox-', $new_file_rel);
        return $new_file_rel;
    }
    $bg = imagecreatetruecolor($w, $h);
    $c = hexrgb($color);
    $white = imagecolorallocate($bg, $c['red'], $c['green'], $c['blue']);
    imagefill($bg, 0, 0, $white);
    $image = wp_get_image_editor($old_file);
    if (!is_wp_error($image)) {
        $current_size = $image->get_size();
        $ow = $current_size['width'];
        $oh = $current_size['height'];
        $new_aspect = $w / $h;
        $old_aspect = $ow / $oh;
        if ($new_aspect > $old_aspect) {
            //taller than goal
            $h_scale = $h / $oh;
            $owt = $ow * $h_scale;
            $y = 0;
            $x = $w / 2 - $owt / 2;
            $oht = $h;
            $image->crop(0, 0, $ow, $oh, $owt, $oht);
        } else {
            $w_scale = $w / $ow;
            $oht = $oh * $w_scale;
            $x = 0;
            $y = $h / 2 - $oht / 2;
            $owt = $w;
            $image->crop(0, 0, $ow, $oh, $owt, $oht);
        }
        $image->save($new_file);
        $func = 'imagecreatefromjpeg';
        $ext = pathinfo($new_file, PATHINFO_EXTENSION);
        if ($ext == 'gif') {
            $func = 'imagecreatefromgif';
        } else {
            if ($ext == 'png') {
                $func = 'imagecreatefrompng';
            }
        }
        $image = $func($new_file);
        imagecopy($bg, $image, $x, $y, 0, 0, $owt, $oht);
        $new_file = str_replace('-lb-', '-lbox-', $new_file);
        imagejpeg($bg, $new_file);
        return TimberHelper::get_rel_path($new_file);
    } else {
        TimberHelper::error_log($image);
    }
    return null;
}
开发者ID:pedrokoblitz,项目名称:centro-dialogo-aberto,代码行数:59,代码来源:functions-twig.php

示例7: desk_css

function desk_css()
{
    $prmd = $_SESSION['prmd'];
    if ($_SESSION['negcss']) {
        $prmd .= '_neg';
    }
    $clr = $_SESSION['clrs'][$prmd];
    req('styl');
    $g = prma('desktop');
    //sesmk('desklr');
    if ($g) {
        req('spe');
        $g = goodroot($g);
    }
    if (is_dir($g)) {
        $ret = 'background:url(' . randimg($g) . ') no-repeat center fixed; background-size:cover;';
    } elseif (is_image($g)) {
        $ret = 'background:url(' . goodroot($g) . ') no-repeat center fixed; background-size:cover;';
    } elseif (strpos($g, ',') === false && $g) {
        $ret = 'background-color:' . affect_rgba($g, $clr) . ';';
        $klr = $g;
    } else {
        $g = affect_rgba($g, $clr);
        $gh = $g ? $g : '#' . $clr[4] . ',#' . $clr[2];
        $klr = medium_clr($gh);
        if (!$g) {
            $g = 'to bottom, ' . hexrgb($clr[4], 0.4) . ', ' . hexrgb($clr[1], 1) . '';
        }
        $ret = 'height:100%; 
	background:linear-gradient(' . $g . ') no-repeat fixed;';
    }
    return css_code('body {' . $ret . '}
	#desktop a, #desktop .philum {color:#' . invert_color($klr, 1) . ';}
	#page {padding:0; margin:0 40px 0 0; border:0; box-shadow:none;}');
}
开发者ID:philum,项目名称:cms,代码行数:35,代码来源:ajxf.php

示例8: proc

 /**
  * @brief 위젯의 실행 부분
  * ./widgets/위젯/conf/info.xml에 선언한 extra_vars를 args로 받는다
  * 결과를 만든후 print가 아니라 return 해주어야 한다
  **/
 function proc($args)
 {
     // 인자 값 정리
     $graph_width = (int) $args->graph_width ? $args->graph_width : 150;
     $graph_height = (int) $args->graph_height ? $args->graph_height : 100;
     $day_range = (int) $args->day_range ? $args->day_range : 7;
     if ($day_range < 7) {
         $day_range = 7;
     }
     $bg_color = hexrgb($args->bg_color ? $args->bg_color : '#FFFFFF');
     $check_bg_color = hexrgb($args->check_bg_color ? $args->check_bg_color : '#F9F9F9');
     $grid_color = hexrgb($args->grid_color ? $args->grid_color : '#dbdbdb');
     $unique_line_color = hexrgb($args->unique_line_color ? $args->unique_line_color : '#BBBBBB');
     $unique_text_color = hexrgb($args->unique_text_color ? $args->unique_text_color : '#666666');
     $point_color = hexrgb($args->point_color ? $args->point_color : '#ed3027');
     // 시작일 부터 오늘까지 일단 배열 만들어 놓기
     $start_time = ztime(date("YmdHis")) - $day_range * 60 * 60 * 24;
     $end_time = time();
     $day_check_falg = 0;
     for ($i = $start_time; $i < $end_time; $i += 60 * 60 * 24) {
         $data[date("Ymd", $i + 60 * 60 * 24)] = 0;
         $day_check_falg++;
         if ($day_check_falg > $day_range) {
             break;
         }
     }
     unset($obj);
     // 현재부터 지난 $day_range동안의 카운터 로그를 가져옴
     $obj->e_regdate = date("Ymd");
     $obj->s_regdate = date("Ymd", ztime(date("YmdHis")) - $day_range * 60 * 60 * 24 + 1);
     $site_module_info = Context::get('site_module_info');
     if ($site_module_info->site_srl) {
         $obj->site_srl = $site_module_info->site_srl;
         $output = executeQuery('widgets.image_counter.getCounterSiteStatus', $obj);
     } else {
         $output = executeQuery('widgets.image_counter.getCounterStatus', $obj);
     }
     $site_srl = (int) $site_module_info->site_srl;
     // 결과가 있다면 loop를 돌면서 최고/최저값을 구하고 그래프를 그릴 준비
     $max_unique_visitor = 0;
     $min_unique_visitor = 99999999999;
     if (count($output->data)) {
         foreach ($output->data as $key => $val) {
             if ($max_unique_visitor < $val->unique_visitor) {
                 $max_unique_visitor = $val->unique_visitor;
             }
             if ($min_unique_visitor > $val->unique_visitor) {
                 $min_unique_visitor = $val->unique_visitor;
             }
             $data[$val->regdate] = $val;
         }
     }
     // 이미지를 그림 (이미지 위치는 ./files/cache/widget_cache/couter_graph.gif로 고정)
     if (!is_dir(_XE_PATH_ . 'files/cache/widget_cache/')) {
         FileHandler::makeDir(_XE_PATH_ . 'files/cache/widget_cache/');
     }
     $image_src = "files/cache/widget_cache/couter_graph." . $site_srl . ".gif";
     // 이미지 생성
     $image = imagecreate($graph_width, $graph_height);
     // 각 종류의 색상을 지정
     $gridLine = imagecolorallocate($image, $grid_color['red'], $grid_color['green'], $grid_color['blue']);
     $fillBack = imagecolorallocate($image, $bg_color['red'], $bg_color['green'], $bg_color['blue']);
     $checkFillBack = imagecolorallocate($image, $check_bg_color['red'], $check_bg_color['green'], $check_bg_color['blue']);
     $visitorLine = imagecolorallocate($image, $unique_line_color['red'], $unique_line_color['green'], $unique_line_color['blue']);
     $visitorText = imagecolorallocate($image, $unique_text_color['red'], $unique_text_color['green'], $unique_text_color['blue']);
     $pointColor = imagecolorallocate($image, $point_color['red'], $point_color['green'], $point_color['blue']);
     // 배경선 채우기
     imagefilledrectangle($image, 0, 0, $graph_width - 1, $graph_height - 1, $fillBack);
     // 가로선 그리기
     $y_gap = ($graph_height - 32) / 3;
     for ($i = 0; $i < 4; $i++) {
         imageline($image, 5, 5 + $i * $y_gap, $graph_width - 5, 5 + $i * $y_gap, $gridLine);
     }
     // 세로선 그리기
     $x_gap = ($graph_width - 30) / ($day_range - 1);
     for ($i = 0; $i < $day_range; $i++) {
         imageline($image, 15 + $i * $x_gap, 5, 15 + $i * $x_gap, $graph_height - 27, $gridLine);
     }
     // 체크 무늬 배경 칠하기
     for ($j = 0; $j < $day_range - 1; $j++) {
         for ($i = 0; $i < 3; $i++) {
             if (($j + $i) % 2 == 1) {
                 continue;
             }
             imagefilledrectangle($image, 15 + $j * $x_gap + 1, 5 + $i * $y_gap + 1, 15 + $j * $x_gap + $x_gap - 1, 5 + $i * $y_gap + $y_gap - 1, $checkFillBack);
         }
     }
     // 그래프 그리기
     $prev_x = 0;
     $prev_y = $graph_height - 45;
     $step = 0;
     // 선 그림
     foreach ($data as $date => $val) {
         // 그래프를 그리기 위한 좌표 구함
         $unique_visitor = $val->unique_visitor;
//.........这里部分代码省略.........
开发者ID:hottaro,项目名称:xpressengine,代码行数:101,代码来源:image_counter.class.php

示例9: lineargradientArea

function lineargradientArea($canvas, $color, $def)
{
    $steps = 20;
    $oc = $canvas;
    $canvas = hexrgb($canvas);
    $oco = $color;
    $color = hexrgb($color);
    $step['r'] = floor(($color['r'] - $canvas['r']) / $steps);
    $step['g'] = floor(($color['g'] - $canvas['g']) / $steps);
    $step['b'] = floor(($color['b'] - $canvas['b']) / $steps);
    $sl = sprintf('%02x%02x%02x', $color['r'] * 0.98, $color['g'] * 0.98, $color['b'] * 0.98);
    $str = "CDEF:shade{$def}s98={$def},0.98,* AREA:shade{$def}s98#{$sl} ";
    for ($i = 1; $i < $steps; $i++) {
        $n = floor(100 - 100 / $steps * $i);
        $n = sprintf('%02d', $n);
        $nr = $color['r'] - $step['r'] * $i;
        $ng = $color['g'] - $step['g'] * $i;
        $nb = $color['b'] - $step['b'] * $i;
        if ($nr > 255) {
            $nr = 255;
        }
        if ($ng > 255) {
            $ng = 255;
        }
        if ($nb > 255) {
            $nb = 255;
        }
        $nc = '#' . sprintf('%02x%02x%02x', $nr, $ng, $nb);
        $str .= " CDEF:shade{$def}s{$n}={$def},0.{$n},* AREA:shade{$def}s{$n}{$nc} ";
    }
    return $str;
}
开发者ID:carriercomm,项目名称:yaketystats,代码行数:32,代码来源:index.php

示例10: imagecolorallocate

    $image_line_color = imagecolorallocate($image, $arr_line_color["red"], $arr_line_color["green"], $arr_line_color["blue"]);
    for ($i = 0; $i < $no_of_lines; $i++) {
        imageline($image, mt_rand(0, $captcha_width), mt_rand(0, $captcha_height), mt_rand(0, $captcha_width), mt_rand(0, $captcha_height), $image_line_color);
    }
}
/* generating the dots randomly in background */
if ($show_noise == "1") {
    $arr_dots_color = hexrgb($noise_color);
    $image_dots_color = imagecolorallocate($image, $arr_dots_color["red"], $arr_dots_color["green"], $arr_dots_color["blue"]);
    for ($i = 0; $i < $noise_level; $i++) {
        imagefilledellipse($image, mt_rand(0, $captcha_width), mt_rand(0, $captcha_height), 2, 3, $image_dots_color);
    }
}
/* create signature on captcha */
if ($show_signature == "1") {
    $arr_signature_color = hexrgb($signature_color);
    $image_signature_color = imagecolorallocate($image, $arr_signature_color["red"], $arr_signature_color["green"], $arr_signature_color["blue"]);
    if (trim($signature) != "") {
        $bbox = imagettfbbox(10, 0, $captcha_font, $signature);
        $textlen = $bbox[2] - $bbox[0];
        $x = $captcha_width - $textlen - 5;
        $y = $captcha_height - 3;
        imagettftext($image, 10, 0, $x, $y, $image_signature_color, $captcha_font, $signature);
    }
}
/* create a text box and add 6 letters code in it */
$textbox = imagettfbbox($size_font, 0, $captcha_font, $code_string);
$x = ($captcha_width - $textbox[4]) / 2;
$y = ($captcha_height - $textbox[5]) / 2;
imagettftext($image, $size_font, 0, $x, $y, $image_text_color, $captcha_font, $code_string);
/* generating background image for Captcha*/
开发者ID:GvarimAZA,项目名称:website,代码行数:31,代码来源:generate-code.php


注:本文中的hexrgb函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。