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


PHP graphics_avail函数代码示例

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


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

示例1: graphics_avail

    }
    if ($mins == 1) {
        $str .= " 1 minute";
    } else {
        $str .= " {$mins} minutes";
    }
    return $str;
}
// create graphics
//
function graphics_avail()
{
    return extension_loaded('gd');
}
if (isset($MYREQUEST['IMG'])) {
    if (!graphics_avail()) {
        exit(0);
    }
    function fill_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1, $color2, $text = '', $placeindex = 0)
    {
        $r = $diameter / 2;
        $w = deg2rad((360 + $start + ($end - $start) / 2) % 360);
        if (function_exists("imagefilledarc")) {
            // exists only if GD 2.0.1 is avaliable
            imagefilledarc($im, $centerX + 1, $centerY + 1, $diameter, $diameter, $start, $end, $color1, IMG_ARC_PIE);
            imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2, IMG_ARC_PIE);
            imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color1, IMG_ARC_NOFILL | IMG_ARC_EDGED);
        } else {
            imagearc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2);
            imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2);
            imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start + 1)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2);
开发者ID:kaoruu,项目名称:centos-php56,代码行数:31,代码来源:apc.php

示例2: graphics_avail

            echo '</tbody></table>';
        }
        echo <<<EOB

\t\t</div>
\t\t<div class="graph div3"><h2>Host Status Diagrams</h2>
\t\t<table cellspacing=0><tbody>
EOB;
        $size = 'width=' . (GRAPH_SIZE + 50) . ' height=' . (GRAPH_SIZE + 10);
        echo <<<EOB
\t\t<tr>
\t\t<td class=td-0>Cache Usage</td>
\t\t<td class=td-1>Hits &amp; Misses</td>
\t\t</tr>
EOB;
        echo graphics_avail() ? '<tr>' . "<td class=td-0><img alt=\"\" {$size} src=\"{$PHP_SELF}&IMG=1&" . (isset($_GET['singleout']) ? 'singleout=' . $_GET['singleout'] . '&' : '') . "{$time}\"></td>" . "<td class=td-1><img alt=\"\" {$size} src=\"{$PHP_SELF}&IMG=2&" . (isset($_GET['singleout']) ? 'singleout=' . $_GET['singleout'] . '&' : '') . "{$time}\"></td></tr>\n" : "", '<tr>', '<td class=td-0><span class="green box">&nbsp;</span>Free: ', bsize($mem_avail) . sprintf(" (%.1f%%)", $mem_avail * 100 / $mem_size), "</td>\n", '<td class=td-1><span class="green box">&nbsp;</span>Hits: ', $hits . sprintf(" (%.1f%%)", $hits * 100 / ($hits + $misses)), "</td>\n", '</tr>', '<tr>', '<td class=td-0><span class="red box">&nbsp;</span>Used: ', bsize($mem_used) . sprintf(" (%.1f%%)", $mem_used * 100 / $mem_size), "</td>\n", '<td class=td-1><span class="red box">&nbsp;</span>Misses: ', $misses . sprintf(" (%.1f%%)", $misses * 100 / ($hits + $misses)), "</td>\n";
        echo <<<EOB
\t</tr>
\t</tbody></table>
<br/>
\t<div class="info"><h2>Cache Information</h2>
\t\t<table cellspacing=0><tbody>
\t\t<tr class=tr-0><td class=td-0>Current Items(total)</td><td>{$curr_items} ({$total_items})</td></tr>
\t\t<tr class=tr-1><td class=td-0>Hits</td><td>{$hits}</td></tr>
\t\t<tr class=tr-0><td class=td-0>Misses</td><td>{$misses}</td></tr>
\t\t<tr class=tr-1><td class=td-0>Request Rate (hits, misses)</td><td>{$req_rate} cache requests/second</td></tr>
\t\t<tr class=tr-0><td class=td-0>Hit Rate</td><td>{$hit_rate} cache requests/second</td></tr>
\t\t<tr class=tr-1><td class=td-0>Miss Rate</td><td>{$miss_rate} cache requests/second</td></tr>
\t\t<tr class=tr-0><td class=td-0>Set Rate</td><td>{$set_rate} cache requests/second</td></tr>
\t\t</tbody></table>
\t\t</div>
开发者ID:hartum,项目名称:basezf,代码行数:31,代码来源:memcache.php

示例3: count

                }
                $ptr = $block['offset'] + $block['size'];
                /* Only consider blocks <5M for the fragmentation % */
                if ($block['size'] < 5 * 1024 * 1024) {
                    $fragsize += $block['size'];
                }
                $freetotal += $block['size'];
            }
            $freeseg += count($mem['block_lists'][$i]);
        }
        if ($freeseg > 1) {
            $frag = sprintf("%.2f%% (%s out of %s in %d fragments)", $fragsize / $freetotal * 100, bsize($fragsize), bsize($freetotal), $freeseg);
        } else {
            $frag = "0%";
        }
        if (graphics_avail()) {
            $size = 'width=' . (2 * GRAPH_SIZE + 150) . ' height=' . (GRAPH_SIZE + 10);
            echo <<<EOB
\t\t\t<img alt="" {$size} src="{$PHP_SELF}?IMG=3&{$time}">
EOB;
        }
        echo <<<EOB
\t\t</br>Fragmentation: {$frag}
\t\t</td>
\t\t</tr>
EOB;
        if (isset($mem['adist'])) {
            foreach ($mem['adist'] as $i => $v) {
                $cur = pow(2, $i);
                $nxt = pow(2, $i + 1) - 1;
                if ($i == 0) {
开发者ID:mnpollotta,项目名称:webinar-framework,代码行数:31,代码来源:apc.php

示例4: graphics_avail

            echo '</tbody></table>';
        }
        echo <<<EOB

\t\t</div>
\t\t<div class="graph div3"><h2>Host Status Diagrams</h2>
\t\t<table cellspacing="0"><tbody>
EOB;
        $size = 'width=' . (GRAPH_SIZE + 50) . ' height=' . (GRAPH_SIZE + 10);
        echo <<<EOB
\t\t<tr>
\t\t<td class="td-0">Cache Usage</td>
\t\t<td class="td-1">Hits &amp; Misses</td>
\t\t</tr>
EOB;
        echo graphics_avail() ? '<tr>' . "<td class='td-0'><img alt=\"\" {$size} src=\"{$INSTALLER09['baseurl']}/staffpanel.php?tool=memcache&amp;IMG=1&amp;" . (isset($_GET['singleout']) ? 'singleout=' . $_GET['singleout'] . '&amp;' : '') . "{$time}\"></td>" . "<td class='td-1'><img alt=\"\" {$size} src=\"{$INSTALLER09['baseurl']}/staffpanel.php?tool=memcache&amp;IMG=2&amp;" . (isset($_GET['singleout']) ? 'singleout=' . $_GET['singleout'] . '&amp;' : '') . "{$time}\"></td></tr>\n" : "", '<tr>', '<td class="td-0"><span class="green box">&nbsp;</span>Free: ', bsize($mem_avail) . sprintf(" (%.1f%%)", $mem_avail * 100 / $mem_size), "</td>\n", '<td class="td-1"><span class="green box">&nbsp;</span>Hits: ', $hits . sprintf(" (%.1f%%)", $hits * 100 / ($hits + $misses)), "</td>\n", '</tr>', '<tr>', '<td class="td-0"><span class="red box">&nbsp;</span>Used: ', bsize($mem_used) . sprintf(" (%.1f%%)", $mem_used * 100 / $mem_size), "</td>\n", '<td class="td-1"><span class="red box">&nbsp;</span>Misses: ', $misses . sprintf(" (%.1f%%)", $misses * 100 / ($hits + $misses)), "</td>\n";
        echo <<<EOB
\t</tr>
\t</tbody></table>
<br/>
\t<div class="info"><h2>Cache Information</h2>
\t\t<table cellspacing="0"><tbody>
\t\t<tr class="tr-0"><td class="td-0">Current Items(total)</td><td>{$curr_items} ({$total_items})</td></tr>
\t\t<tr class="tr-1"><td class="td-0">Hits</td><td>{$hits}</td></tr>
\t\t<tr class="tr-0"><td class="td-0">Misses</td><td>{$misses}</td></tr>
\t\t<tr class="tr-1"><td class="td-0">Request Rate (hits, misses)</td><td>{$req_rate} cache requests/second</td></tr>
\t\t<tr class="tr-0"><td class="td-0">Hit Rate</td><td>{$hit_rate} cache requests/second</td></tr>
\t\t<tr class="tr-1"><td class="td-0">Miss Rate</td><td>{$miss_rate} cache requests/second</td></tr>
\t\t<tr class="tr-0"><td class="td-0">Set Rate</td><td>{$set_rate} cache requests/second</td></tr>
\t\t</tbody></table>
\t\t</div>
开发者ID:Bigjoos,项目名称:U-232-V5,代码行数:31,代码来源:memcache.php

示例5:

		</div>
		<div class="graph div3"><h2>Host Status Diagrams</h2>
		<table cellspacing=0><tbody>
EOB;

	$size='width='.(GRAPH_SIZE+50).' height='.(GRAPH_SIZE+10);
	echo <<<EOB
		<tr>
		<td class=td-0>Cache Usage</td>
		<td class=td-1>Hits &amp; Misses</td>
		</tr>
EOB;

	echo
		graphics_avail() ?
			  '<tr>'.
			  "<td class=td-0><img alt=\"\" $size src=\"$PHP_SELF&IMG=1&".(isset($_GET['singleout'])? 'singleout='.$_GET['singleout'].'&':'')."$time\"></td>".
			  "<td class=td-1><img alt=\"\" $size src=\"$PHP_SELF&IMG=2&".(isset($_GET['singleout'])? 'singleout='.$_GET['singleout'].'&':'')."$time\"></td></tr>\n"
			: "",
		'<tr>',
		'<td class=td-0><span class="green box">&nbsp;</span>Free: ',bsize($mem_avail).sprintf(" (%.1f%%)",$mem_avail*100/$mem_size),"</td>\n",
		'<td class=td-1><span class="green box">&nbsp;</span>Hits: ',$hits.sprintf(" (%.1f%%)",$hits*100/($hits+$misses)),"</td>\n",
		'</tr>',
		'<tr>',
		'<td class=td-0><span class="red box">&nbsp;</span>Used: ',bsize($mem_used ).sprintf(" (%.1f%%)",$mem_used *100/$mem_size),"</td>\n",
		'<td class=td-1><span class="red box">&nbsp;</span>Misses: ',$misses.sprintf(" (%.1f%%)",$misses*100/($hits+$misses)),"</td>\n";
		echo <<< EOB
	</tr>
	</tbody></table>
<br/>
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:30,代码来源:mem.php

示例6: indexAction


//.........这里部分代码省略.........
                }
            }
        }
        // select cache mode
        if ($AUTHENTICATED && $MYREQUEST['OB'] == OB_USER_CACHE) {
            $cache_mode = 'user';
        }
        // clear cache
        if ($AUTHENTICATED && isset($MYREQUEST['CC']) && $MYREQUEST['CC']) {
            apc_clear_cache($cache_mode);
        }
        if ($AUTHENTICATED && !empty($MYREQUEST['DU'])) {
            apc_delete($MYREQUEST['DU']);
        }
        if (!function_exists('apc_cache_info') || !($cache = @apc_cache_info($cache_mode))) {
            echo "No cache info available.  APC does not appear to be running.";
            exit;
        }
        $cache_user = apc_cache_info('user', 1);
        $mem = apc_sma_info();
        if (!$cache['num_hits']) {
            $cache['num_hits'] = 1;
            $time++;
        }
        // Avoid division by 0 errors on a cache clear
        // don't cache this page
        //
        header("Cache-Control: no-store, no-cache, must-revalidate");
        // HTTP/1.1
        header("Cache-Control: post-check=0, pre-check=0", false);
        header("Pragma: no-cache");
        // HTTP/1.0
        if (isset($MYREQUEST['IMG'])) {
            if (!graphics_avail()) {
                exit(0);
            }
            $size = GRAPH_SIZE;
            // image size
            if ($MYREQUEST['IMG'] == 3) {
                $image = imagecreate(2 * $size + 150, $size + 10);
            } else {
                $image = imagecreate($size + 50, $size + 10);
            }
            $col_white = imagecolorallocate($image, 0xff, 0xff, 0xff);
            $col_red = imagecolorallocate($image, 0xd0, 0x60, 0x30);
            $col_green = imagecolorallocate($image, 0x60, 0xf0, 0x60);
            $col_black = imagecolorallocate($image, 0, 0, 0);
            imagecolortransparent($image, $col_white);
            switch ($MYREQUEST['IMG']) {
                case 1:
                    $s = $mem['num_seg'] * $mem['seg_size'];
                    $a = $mem['avail_mem'];
                    $x = $y = $size / 2;
                    $fuzz = 1.0E-6;
                    // This block of code creates the pie chart.  It is a lot more complex than you
                    // would expect because we try to visualize any memory fragmentation as well.
                    $angle_from = 0;
                    $string_placement = array();
                    for ($i = 0; $i < $mem['num_seg']; $i++) {
                        $ptr = 0;
                        $free = $mem['block_lists'][$i];
                        foreach ($free as $block) {
                            if ($block['offset'] != $ptr) {
                                // Used block
                                $angle_to = $angle_from + ($block['offset'] - $ptr) / $s;
                                if ($angle_to + $fuzz > 1) {
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:67,代码来源:ApcController.php

示例7: graphics_avail

<div class="row">
    <div class="span8">

        <h2>Host Status Diagrams</h2>
        <table class="table table-striped"><thead>
EOB;
        $size = 'width=' . (GRAPH_SIZE + 50) . ' height=' . (GRAPH_SIZE + 10);
        echo <<<EOB
        <tr>
        <th>Cache Usage</th>
        <th>Hits &amp; Misses</th>
        </tr>
        </thead>
        <tbody>
EOB;
        echo graphics_avail() ? '<tr>' . "<td><img alt=\"\" {$size} src=\"{$PHP_SELF}&IMG=1&" . (isset($_GET['singleout']) ? 'singleout=' . $_GET['singleout'] . '&' : '') . "{$time}\"></td>" . "<td><img alt=\"\" {$size} src=\"{$PHP_SELF}&IMG=2&" . (isset($_GET['singleout']) ? 'singleout=' . $_GET['singleout'] . '&' : '') . "{$time}\"></td></tr>\n" : "", '<tr>', '<td><span class="label label-success">Free</span> ', bsize($mem_avail) . sprintf(" (%.1f%%)", $mem_avail * 100 / $mem_size), "</td>\n", '<td><span class="label label-success">Hits</span> ', $hits . sprintf(" (%.1f%%)", $hits * 100 / ($hits + $misses)), "</td>\n", '</tr>', '<tr>', '<td><span class="label label-important">Used</span> ', bsize($mem_used) . sprintf(" (%.1f%%)", $mem_used * 100 / $mem_size), "</td>\n", '<td><span class="label label-important">Misses</span> ', $misses . sprintf(" (%.1f%%)", $misses * 100 / ($hits + $misses)), "</td>\n";
        echo <<<EOB
    </tr>
    </tbody></table>
    </div>
</div>
<div class="row">
    <div class="span8">
\t<h2>Cache Information</h2>
\t\t<table class="table table-striped"><tbody>
\t\t<tr><th scope="row">Current Items(total)</th><td>{$curr_items} ({$total_items})</td></tr>
\t\t<tr><th scope="row">Hits</td><td>{$hits}</td></tr>
\t\t<tr><th scope="row">Misses</td><td>{$misses}</td></tr>
\t\t<tr><th scope="row">Request Rate (hits, misses)</td><td>{$req_rate} cache requests/second</td></tr>
\t\t<tr><th scope="row"><span class="label label-success">Hit Rate</span></td><td>{$hit_rate} cache requests/second</td></tr>
\t\t<tr><th scope="row"><span class="label label-important">Miss Rate</span></td><td>{$miss_rate} cache requests/second</td></tr>
开发者ID:rfrancis2823,项目名称:memcache.php,代码行数:31,代码来源:memcache.php


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