本文整理汇总了PHP中reScale函数的典型用法代码示例。如果您正苦于以下问题:PHP reScale函数的具体用法?PHP reScale怎么用?PHP reScale使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了reScale函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: outputlivestream
function outputlivestream($monitor, $inwidth = 0, $inheight = 0)
{
$scale = isset($_REQUEST['scale']) ? validInt($_REQUEST['scale']) : reScale(SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE);
$connkey = $monitor['connKey'];
// Minor hack
//$connKey = generateConnKey();
if (ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT) {
$streamMode = "mpeg";
$streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "bitrate=" . ZM_WEB_VIDEO_BITRATE, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "format=" . ZM_MPEG_LIVE_FORMAT, "buffer=" . $monitor['StreamReplayBuffer']));
} elseif (canStream()) {
$streamMode = "jpeg";
$streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "buffer=" . $monitor['StreamReplayBuffer']));
} else {
$streamMode = "single";
$streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale));
}
$width = !empty($inwidth) ? $inwidth : 150;
$height = empty($inheight) ? $width * $monitor['Height'] / $monitor['Width'] : $inheight;
$width = (int) $width;
$height = (int) $height;
if ($streamMode === "mpeg") {
outputVideoStream('liveStream' . $monitor['Id'], $streamSrc, reScale($width, $scale), reScale($height, $scale), ZM_MPEG_LIVE_FORMAT, $monitor['Name']);
} elseif ($streamMode == "jpeg") {
if (canStreamNative()) {
outputImageStream('liveStream' . $monitor['Id'], $streamSrc, reScale($width, $scale), reScale($height, $scale), $monitor['Name']);
} elseif (canStreamApplet()) {
outputHelperStream('liveStream' . $monitor['Id'], $streamSrc, reScale($width, $scale), reScale($height, $scale), $monitor['Name']);
}
} else {
outputImageStill('liveStream' . $monitor['Id'], $streamSrc, reScale($width, $scale), reScale($height, $scale), $monitor['Name']);
}
}
示例2: addEventToZip
function addEventToZip($eid, $mid, $zip)
{
$query = "SELECT Id, MonitorId, StartTime, Frames FROM Events WHERE Id={$eid}";
$results = dbFetchAll($query);
$scale = max(reScale(SCALE_BASE, '100', ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
foreach ($results as $result) {
for ($counter = 1; $counter <= $result['Frames']; $counter++) {
$event['Id'] = $result['Id'];
$event['StartTime'] = $result['StartTime'];
$event['MonitorId'] = $result['MonitorId'];
$imageData = getImageSrc($event, $counter, $scale, isset($_REQUEST['show']) && $_REQUEST['show'] == "capt");
$imagePath = $imageData['thumbPath'];
$eventPath = $imageData['eventPath'];
$dImagePath = sprintf("%s/%0" . ZM_EVENT_IMAGE_DIGITS . "d-diag-d.jpg", $eventPath, $counter);
$rImagePath = sprintf("%s/%0" . ZM_EVENT_IMAGE_DIGITS . "d-diag-r.jpg", $eventPath, $counter);
$frames[] = viewImagePath($imagePath);
}
$zip->addDirectory("events/" . $event['MonitorId']);
$zip->addDirectory("events/" . $event['MonitorId'] . "/" . $event['Id']);
}
$i = 0;
$filesString = "";
foreach ($frames as $frame) {
$i++;
$filesName = sprintf("%0" . ZM_EVENT_IMAGE_DIGITS . "d-capture.jpg", $i);
$filesString .= "\nframes.push(\"events/" . $mid . "/" . $eid . "/" . $filesName . "\");";
$zip->addLargeFile($frame, "events/" . $mid . "/" . $eid . "/" . $filesName);
}
return $filesString;
}
示例3: outputLiveStreamSrcModern
function outputLiveStreamSrcModern($monitor, $inwidth = 0, $inheight = 0)
{
$scale = isset($_REQUEST['scale']) ? validInt($_REQUEST['scale']) : reScale(SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE);
$connKey = generateAuthHashModern(false);
//$connkey = $monitor['connKey']; // Minor hack
if (ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT) {
$streamMode = "mpeg";
$streamSrc = getStreamSrcModern(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "bitrate=" . ZM_WEB_VIDEO_BITRATE, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "format=" . ZM_MPEG_LIVE_FORMAT, "buffer=" . $monitor['StreamReplayBuffer']));
} elseif (canStream()) {
$streamMode = "jpeg";
$streamSrc = getStreamSrcModern(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "buffer=" . $monitor['StreamReplayBuffer']));
} else {
$streamMode = "single";
$streamSrc = getStreamSrcModern(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale));
}
return $streamSrc;
}
示例4: getStreamHTML
function getStreamHTML($monitor, $scale = 100)
{
//FIXME, the width and height of the image need to be scaled.
if (ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT) {
$streamSrc = $monitor->getStreamSrc(array("mode=mpeg", "scale=" . $scale, "bitrate=" . ZM_WEB_VIDEO_BITRATE, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "format=" . ZM_MPEG_LIVE_FORMAT));
outputVideoStream("liveStream", $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), ZM_MPEG_LIVE_FORMAT, $monitor->Name());
} else {
if (canStream()) {
$streamSrc = $monitor->getStreamSrc(array('mode=jpeg', 'scale=' . $scale, 'maxfps=' . ZM_WEB_VIDEO_MAXFPS, 'buffer=' . $monitor->StreamReplayBuffer()));
if (canStreamNative()) {
outputImageStream("liveStream", $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), $monitor->Name());
} elseif (canStreamApplet()) {
outputHelperStream("liveStream", $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), $monitor->Name());
}
} else {
$streamSrc = $monitor->getStreamSrc(array('mode=single', "scale=" . $scale));
outputImageStill("liveStream", $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), $monitor->Name());
Info("The system has fallen back to single jpeg mode for streaming. Consider enabling Cambozola or upgrading the client browser.");
}
}
}
示例5: dbFetchAll
/views/assets/images/onerror.png">
</main>
<script src="skins/<?php
echo $skin;
?>
/views/assets/vendor/js/jquery.min.js"></script>
<script>
var eid = <?php
echo $_REQUEST['eid'];
?>
;
<?php
$query = "SELECT Id, MonitorId, StartTime, Frames FROM Events WHERE Id={$_REQUEST['eid']}";
$results = dbFetchAll($query);
$scale = max(reScale(SCALE_BASE, '100', ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
foreach ($results as $result) {
for ($counter = 1; $counter <= $result['Frames']; $counter++) {
$event['Id'] = $result['Id'];
$event['StartTime'] = $result['StartTime'];
$event['MonitorId'] = $result['MonitorId'];
$imageData = getImageSrc($event, $counter, $scale, isset($_REQUEST['show']) && $_REQUEST['show'] == "capt");
$imagePath = $imageData['thumbPath'];
$eventPath = $imageData['eventPath'];
$dImagePath = sprintf("%s/%0" . ZM_EVENT_IMAGE_DIGITS . "d-diag-d.jpg", $eventPath, $counter);
$rImagePath = sprintf("%s/%0" . ZM_EVENT_IMAGE_DIGITS . "d-diag-r.jpg", $eventPath, $counter);
$frames[] = viewImagePath($imagePath);
}
}
echo "var unprocessed = '" . implode(',', $frames) . "';";
echo "var frames = unprocessed.split(',');";
示例6: zmaStatus
$monitors[$i]['zma'] = zmaStatus($monitors[$i]);
}
$monitors[$i]['ZoneCount'] = dbFetchOne("select count(Id) as ZoneCount from Zones where MonitorId = '" . $monitors[$i]['Id'] . "'", "ZoneCount");
$counts = array();
for ($j = 0; $j < count($eventCounts); $j++) {
$filter = addFilterTerm($eventCounts[$j]['filter'], count($eventCounts[$j]['filter']['terms']), array("cnj" => "and", "attr" => "MonitorId", "op" => "=", "val" => $monitors[$i]['Id']));
parseFilter($filter);
$counts[] = "count(if(1" . $filter['sql'] . ",1,NULL)) as EventCount{$j}";
$monitors[$i]['eventCounts'][$j]['filter'] = $filter;
}
$sql = "select " . join($counts, ", ") . " from Events as E where MonitorId = '" . $monitors[$i]['Id'] . "'";
$counts = dbFetchOne($sql);
if ($monitors[$i]['Function'] != 'None') {
$cycleCount++;
$scaleWidth = reScale($monitors[$i]['Width'], $monitors[$i]['DefaultScale'], ZM_WEB_DEFAULT_SCALE);
$scaleHeight = reScale($monitors[$i]['Height'], $monitors[$i]['DefaultScale'], ZM_WEB_DEFAULT_SCALE);
if ($maxWidth < $scaleWidth) {
$maxWidth = $scaleWidth;
}
if ($maxHeight < $scaleHeight) {
$maxHeight = $scaleHeight;
}
}
$monitors[$i] = array_merge($monitors[$i], $counts);
$seqIdList[] = $monitors[$i]['Id'];
$displayMonitors[] = $monitors[$i];
}
$states = dbFetchAll("select * from States");
/* XML Dump Starts here */
xml_header();
/* Print out the general section */
示例7: validHtmlStr
</a>
</div>
<h2><?php
echo $SLANG['Cycle'];
?>
- <?php
echo validHtmlStr($monitor['Name']);
?>
</h2>
</div>
<div id="content">
<div id="imageFeed">
<?php
if ($streamMode == "mpeg") {
outputVideoStream("liveStream", $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), ZM_MPEG_LIVE_FORMAT, validHtmlStr($monitor['Name']));
} elseif ($streamMode == "jpeg") {
if (canStreamNative()) {
outputImageStream("liveStream", $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), validHtmlStr($monitor['Name']));
} elseif (canStreamApplet()) {
outputHelperStream("liveStream", $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), validHtmlStr($monitor['Name']));
}
} else {
outputImageStill("liveStream", $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), validHtmlStr($monitor['Name']));
}
?>
</div>
</div>
</div>
</body>
</html>
示例8: dbFetchOne
}
$sql = 'SELECT E.*,M.Name AS MonitorName,M.DefaultRate FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE E.Id = ?' . $midSql;
$event = dbFetchOne($sql, NULL, array($_REQUEST['eid']));
$deviceWidth = isset($device) && !empty($device['width']) ? $device['width'] : DEVICE_WIDTH;
$deviceHeight = isset($device) && !empty($device['height']) ? $device['height'] : DEVICE_HEIGHT;
if ($deviceWidth >= 352 && $deviceHeight >= 288) {
$videoSize = "352x288";
} elseif ($deviceWidth >= 176 && $deviceHeight >= 144) {
$videoSize = "176x144";
} else {
$videoSize = "128x96";
}
$eventWidth = $event['Width'];
$eventHeight = $event['Height'];
if (!isset($rate)) {
$_REQUEST['rate'] = reScale(RATE_BASE, $event['DefaultRate'], ZM_WEB_DEFAULT_RATE);
}
$eventPath = ZM_DIR_EVENTS . '/' . getEventPath($event);
$videoFormats = array();
$ffmpegFormats = preg_split('/\\s+/', ZM_FFMPEG_FORMATS);
foreach ($ffmpegFormats as $ffmpegFormat) {
preg_match('/^([^*]+)(\\**)$/', $ffmpegFormat, $matches);
$videoFormats[$matches[1]] = $matches[1];
if ($matches[2] == '*') {
$defaultVideoFormat = $matches[1];
} elseif ($matches[2] == '**') {
$defaultPhoneFormat = $matches[1];
}
}
if (!isset($_REQUEST['videoFormat'])) {
if (isset($defaultPhoneFormat)) {
示例9: elseif
} elseif ($streamMode == "jpeg") {
if (canStreamNative()) {
outputImageStream("liveStream", $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), $monitor['Name']);
} elseif (canStreamApplet()) {
outputHelperStream("liveStream", $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), $monitor['Name']);
}
} else {
?>
<a href="?view=<?php
echo $_REQUEST['view'];
?>
&mid=<?php
echo $monitor['Id'];
?>
"><?php
echo outputImageStill("liveStream", $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), $monitor['Name']);
?>
</a>
<?php
}
?>
</p>
<?php
if ($showPtzControls) {
foreach (getSkinIncludes('includes/control_functions.php') as $includeFile) {
require_once $includeFile;
}
?>
<div id="ptzControls">
<?php
echo ptzControls($monitor);
示例10: reScale
<div id="imagePanel">
<div id="imageFrame" style="width: <?php
echo reScale($monitor->Width(), $scale);
?>
px; height: <?php
echo reScale($monitor->Height(), $scale);
?>
px;">
<?php
echo getStreamHTML($monitor, $scale);
?>
<svg id="zoneSVG" class="zones" style="width: <?php
echo reScale($monitor->Width(), $scale);
?>
px; height: <?php
echo reScale($monitor->Height(), $scale);
?>
px;margin-top: -<?php
echo $monitor->Height;
?>
px;background: none;">
<polygon id="zonePoly" points="<?php
echo $zone['AreaCoords'];
?>
" class="<?php
echo $zone['Type'];
?>
"/>
Sorry, your browser does not support inline SVG
</svg>
</div>
示例11: elseif
$dclass = "warnText";
} else {
$dclass = "infoText";
}
}
if ($monitor['Function'] == 'None') {
$fclass = "errorText";
} elseif ($monitor['Function'] == 'Monitor') {
$fclass = "warnText";
} else {
$fclass = "infoText";
}
if (!$monitor['Enabled']) {
$fclass .= " disabledText";
}
$scale = max(reScale(SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
?>
<!-- <tr>
<td><?php
echo $monitor['Name'];
?>
</td>
<td class="colFunction"><?php
echo makePopupLink('?view=function&mid=' . $monitor['Id'], 'zmFunction', 'function', '<span class="' . $fclass . '">' . $monitor['Function'] . '</span>');
?>
</td>
<?php
if ($monitor['Type'] == "Local") {
?>
<td class="colSource"><?php
echo makePopupLink('?view=monitor&mid=' . $monitor['Id'], 'zmMonitor' . $monitor['Id'], 'monitor', '<span class="' . $dclass . '">' . $monitor['Device'] . ' (' . $monitor['Channel'] . ')</span>');
示例12: elseif
elseif ( !empty( $limit ) )
{
$eventsSql .= " limit 0, ".dbEscape($limit);
}
*/
$eventsSql .= " limit {$offset},{$events_per_page} ";
$maxWidth = 0;
$maxHeight = 0;
$archived = false;
$unarchived = false;
$events = array();
foreach (dbFetchAll($eventsSql) as $event) {
$events[] = $event;
$scale = max(reScale(SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
$eventWidth = reScale($event['Width'], $scale);
$eventHeight = reScale($event['Height'], $scale);
if ($maxWidth < $eventWidth) {
$maxWidth = $eventWidth;
}
if ($maxHeight < $eventHeight) {
$maxHeight = $eventHeight;
}
if ($event['Archived']) {
$archived = true;
} else {
$unarchived = true;
}
}
$count = count($events);
?>
<input type="hidden" id="inptMonitorName" value="<?php
示例13: max
$data .= '[' . $event['jstime'] . ', ' . $event[$defeventtype[$eventtype][0]] . '],';
} else {
$data .= '[' . $event[$defeventtype[$eventtype][0]] . ', ' . $event['jstime'] . '],';
}
if ($event['type'] == 'single') {
$datapoint .= '[' . $event['jstime'] . ', ' . $event[$defeventtype[$eventtype][0]] . '],';
$scale = max(reScale(SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
$eventdetail .= '[' . $event['eventid'] . ',' . reScale($event['Width'], $scale) . ',' . reScale($event['Height'], $scale) . '],';
} else {
$e_ids = explode(',', $event['eventid']);
$e_hs = explode(',', $event['Height']);
$e_ws = explode(',', $event['Width']);
foreach ($e_ids as $k => $id) {
$datapoint .= '[' . $event['jstime'] . ', ' . $event[$defeventtype[$eventtype][0]] . '],';
$scale = max(reScale(SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
$eventdetail .= '[' . $id . ',' . reScale($e_ws[$k], $scale) . ',' . reScale($e_hs[$k], $scale) . '],';
}
$mydate = date('Y-m-d', $event['mktime']);
switch ($interval) {
case '1day':
$myinterval = '1hr';
$mystime = $event['mktime'];
$myetime = $event['mktime'] + 86399;
break;
case '1hr':
$myinterval = 'event';
$mystime = $event['mktime'];
$myetime = $event['mktime'] + 3599;
break;
case '5min':
$myinterval = 'event';
示例14: getStreamSrc
</video>
</div>
<?php
} else {
?>
<div id="imageFeed">
<?php
if (ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT) {
$streamSrc = getStreamSrc(array("source=event", "mode=mpeg", "event=" . $eid, "frame=" . $fid, "scale=" . $scale, "rate=" . $rate, "bitrate=" . ZM_WEB_VIDEO_BITRATE, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "format=" . ZM_MPEG_REPLAY_FORMAT, "replay=" . $replayMode));
outputVideoStream("evtStream", $streamSrc, reScale($event['Width'], $scale), reScale($event['Height'], $scale), ZM_MPEG_LIVE_FORMAT);
} else {
$streamSrc = getStreamSrc(array("source=event", "mode=jpeg", "event=" . $eid, "frame=" . $fid, "scale=" . $scale, "rate=" . $rate, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "replay=" . $replayMode));
if (canStreamNative()) {
outputImageStream("evtStream", $streamSrc, reScale($event['Width'], $scale), reScale($event['Height'], $scale), validHtmlStr($event['Name']));
} else {
outputHelperStream("evtStream", $streamSrc, reScale($event['Width'], $scale), reScale($event['Height'], $scale));
}
}
# end if ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT )
?>
</div>
<p id="dvrControls">
<input type="button" value="<+" id="prevBtn" title="<?php
echo translate('Prev');
?>
" class="inactive" onclick="streamPrev( true )"/>
<input type="button" value="<<" id="fastRevBtn" title="<?php
echo translate('Rewind');
?>
" class="inactive" disabled="disabled" onclick="streamFastRev( true )"/>
<input type="button" value="<" id="slowRevBtn" title="<?php
示例15: outputVideoStream
echo $monitor->scaleWidth();
?>
, <?php
echo $monitor->scaleHeight();
?>
);">
<?php
if (ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT) {
$streamSrc = $monitor->getStreamSrc(array("mode=mpeg", "scale=" . $scale, "bitrate=" . ZM_WEB_VIDEO_BITRATE, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "format=" . ZM_MPEG_LIVE_FORMAT));
outputVideoStream("liveStream" . $monitor->Id(), $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), ZM_MPEG_LIVE_FORMAT);
} else {
$streamSrc = $monitor->getStreamSrc(array("mode=jpeg", "scale=" . $scale, "maxfps=" . ZM_WEB_VIDEO_MAXFPS));
if (canStreamNative()) {
outputImageStream("liveStream" . $monitor->Id(), $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), validHtmlStr($monitor->Name()));
} else {
outputHelperStream("liveStream" . $monitor->Id(), $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale));
}
}
?>
</div>
<?php
if (!ZM_WEB_COMPACT_MONTAGE) {
?>
<div id="monitorState<?php
echo $monitor->index();
?>
" class="monitorState idle"><?php
echo translate('State');
?>
: <span id="stateValue<?php
echo $monitor->index();