2003-07-11 17:27:56 +08:00
< ? php
2004-01-08 19:45:57 +08:00
//
// ZoneMinder web event view file, $Date$, $Revision$
// Copyright (C) 2003 Philip Coombes
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
2003-07-11 17:27:56 +08:00
2004-01-08 19:45:57 +08:00
if ( ! canView ( 'Events' ) )
{
$view = " error " ;
return ;
}
if ( ! isset ( $mode ) )
{
if ( canStream () )
$mode = " stream " ;
else
$mode = " still " ;
}
2003-07-11 17:27:56 +08:00
2004-03-10 01:07:09 +08:00
if ( $user [ 'MonitorIds' ] )
{
$mid_sql = " and MonitorId in ( " . join ( " , " , preg_split ( '/["\'\s]*,["\'\s]*/' , $user [ 'MonitorIds' ] ) ) . " ) " ;
}
else
{
$mid_sql = '' ;
}
2004-03-10 22:23:22 +08:00
$sql = " select E.*,M.Name as MonitorName,M.Width,M.Height from Events as E inner join Monitors as M on E.MonitorId = M.Id where E.Id = ' $eid ' $mid_sql " ;
$result = mysql_query ( $sql );
2004-01-08 19:45:57 +08:00
if ( ! $result )
die ( mysql_error () );
$event = mysql_fetch_assoc ( $result );
2003-07-11 17:27:56 +08:00
2004-03-10 22:23:22 +08:00
parseSort ();
parseFilter ();
2004-03-10 01:07:09 +08:00
2004-04-19 18:38:22 +08:00
$sql = " select E.* from Events as E inner join Monitors as M on E.MonitorId = M.Id where $sort_column " . ( $sort_order == 'asc' ? '<=' : '>=' ) . " ' " . $event [ $sort_field ] . " ' $filter_sql $mid_sql order by $sort_column " . ( $sort_order == 'asc' ? 'desc' : 'asc' );
2004-03-10 22:23:22 +08:00
$result = mysql_query ( $sql );
2004-01-08 19:45:57 +08:00
if ( ! $result )
die ( mysql_error () );
2004-03-10 22:23:22 +08:00
while ( $row = mysql_fetch_assoc ( $result ) )
{
if ( $row [ Id ] == $eid )
{
$prev_event = mysql_fetch_assoc ( $result );
break ;
}
}
2004-01-08 19:45:57 +08:00
2004-04-19 18:38:22 +08:00
$sql = " select E.* from Events as E inner join Monitors as M on E.MonitorId = M.Id where $sort_column " . ( $sort_order == 'asc' ? '>=' : '<=' ) . " ' " . $event [ $sort_field ] . " ' $filter_sql $mid_sql order by $sort_column $sort_order " ;
2004-03-10 22:23:22 +08:00
$result = mysql_query ( $sql );
2004-01-08 19:45:57 +08:00
if ( ! $result )
die ( mysql_error () );
2004-03-10 22:23:22 +08:00
while ( $row = mysql_fetch_assoc ( $result ) )
{
if ( $row [ Id ] == $eid )
{
$next_event = mysql_fetch_assoc ( $result );
break ;
}
}
2004-01-08 19:45:57 +08:00
if ( ! isset ( $rate ) )
2004-03-15 06:24:09 +08:00
$rate = ZM_WEB_DEFAULT_RATE ;
2004-01-08 19:45:57 +08:00
if ( ! isset ( $scale ) )
2004-03-15 06:24:09 +08:00
$scale = ZM_WEB_DEFAULT_SCALE ;
2003-07-11 17:27:56 +08:00
2004-09-23 20:06:21 +08:00
$frames_per_page = ZM_WEB_FRAMES_PER_LINE * ZM_WEB_FRAME_LINES ;
2003-11-14 18:28:17 +08:00
2004-01-08 19:45:57 +08:00
$paged = $event [ 'Frames' ] > $frames_per_page ;
2003-11-14 18:28:17 +08:00
2003-07-11 17:27:56 +08:00
?>
< html >
< head >
2004-01-08 18:09:35 +08:00
< title > ZM - < ? = $zmSlangEvent ?> - <?= $event['Name'] ?></title>
2003-07-11 17:27:56 +08:00
< link rel = " stylesheet " href = " zm_styles.css " type = " text/css " >
< script language = " JavaScript " >
< ? php
2004-01-08 19:45:57 +08:00
if ( ! $event )
{
2003-07-11 17:27:56 +08:00
?>
opener . location . reload ( true );
window . close ();
< ? php
2004-01-08 19:45:57 +08:00
}
2003-07-11 17:27:56 +08:00
?>
window . focus ();
< ? php
2004-01-08 19:45:57 +08:00
if ( ! empty ( $refresh_parent ) )
{
2003-07-11 17:27:56 +08:00
?>
opener . location . reload ( true );
< ? php
2004-01-08 19:45:57 +08:00
}
2003-07-11 17:27:56 +08:00
?>
function refreshWindow ()
{
window . location . reload ( true );
}
function closeWindow ()
{
window . close ();
}
function newWindow ( Url , Name , Width , Height )
{
2003-12-16 22:39:43 +08:00
var Name = window . open ( Url , Name , " resizable,width= " + Width + " ,height= " + Height );
2003-07-11 17:27:56 +08:00
}
</ script >
</ head >
2003-12-16 22:56:36 +08:00
< body scroll = " auto " >
2003-07-11 17:27:56 +08:00
< table border = " 0 " cellspacing = " 0 " cellpadding = " 4 " width = " 100% " >
< tr >
< td colspan = " 3 " align = " left " class = " text " >
< form name = " rename_form " method = " get " action = " <?= $PHP_SELF ?> " >
< input type = " hidden " name = " view " value = " <?= $view ?> " >
< input type = " hidden " name = " action " value = " rename " >
< input type = " hidden " name = " eid " value = " <?= $eid ?> " >
2004-04-21 17:20:28 +08:00
< ? = $filter_fields ?>
< input type = " hidden " name = " sort_field " value = " <?= $sort_field ?> " >
< input type = " hidden " name = " sort_asc " value = " <?= $sort_asc ?> " >
< input type = " hidden " name = " limit " value = " <?= $limit ?> " >
< input type = " hidden " name = " rate " value = " <?= $rate ?> " >
< input type = " hidden " name = " scale " value = " <?= $scale ?> " >
< input type = " hidden " name = " page " value = " <?= $page ?> " >
2004-01-08 18:09:35 +08:00
< input type = " text " size = " 16 " name = " event_name " value = " <?= $event['Name'] ?> " class = " form " >
2004-01-07 20:57:07 +08:00
< input type = " submit " value = " <?= $zmSlangRename ?> " class = " form " < ? php if ( ! canEdit ( 'Events' ) ) { ?> disabled<?php } ?>></form></td>
2003-10-16 17:02:07 +08:00
< ? php if ( 0 ) { ?>
2003-10-10 18:38:30 +08:00
< td colspan = " 2 " align = " right " class = " text " >
2003-07-11 17:27:56 +08:00
< form name = " learn_form " method = " get " action = " <?= $PHP_SELF ?> " >
< input type = " hidden " name = " view " value = " <?= $view ?> " >
< input type = " hidden " name = " action " value = " learn " >
< input type = " hidden " name = " eid " value = " <?= $eid ?> " >
< input type = " hidden " name = " mark_eid " value = " <?= $eid ?> " >
< ? php if ( LEARN_MODE ) { ?>
2004-01-08 18:09:35 +08:00
Learn Pref :& nbsp ; < select name = " learn_state " class = " form " onChange = " learn_form.submit(); " >< option value = " " < ? php if ( ! $event [ 'LearnState' ] ) echo " selected " ?> ><?= $zmSlangIgnore ?></option><option value="-"<?php if ( $event['LearnState']=='-' ) echo " selected" ?>><?= $zmSlangExclude ?></option><option value="+"<?php if ( $event['LearnState']=='+' ) echo " selected" ?>><?= $zmSlangInclude ?></option></select>
2003-07-11 17:27:56 +08:00
< ? php } ?>
</ form ></ td >
2003-10-16 17:02:07 +08:00
< ? php } ?>
< td colspan = " 3 " align = " right " class = " text " >
2003-10-19 17:47:52 +08:00
< form name = " view_form " method = " get " action = " <?= $PHP_SELF ?> " >
2003-10-10 18:38:30 +08:00
< input type = " hidden " name = " view " value = " <?= $view ?> " >
< input type = " hidden " name = " eid " value = " <?= $eid ?> " >
2004-03-10 22:23:22 +08:00
< ? = $filter_fields ?>
2004-04-21 17:20:28 +08:00
< input type = " hidden " name = " sort_field " value = " <?= $sort_field ?> " >
< input type = " hidden " name = " sort_asc " value = " <?= $sort_asc ?> " >
< input type = " hidden " name = " limit " value = " <?= $limit ?> " >
2004-01-07 20:57:07 +08:00
< ? = $zmSlangRate ?> : <?= buildSelect( "rate", $rates, "document.view_form.submit();" ); ?>
< ? = $zmSlangScale ?> : <?= buildSelect( "scale", $scales, "document.view_form.submit();" ); ?>
2003-10-10 18:38:30 +08:00
</ form >
</ td >
2003-07-11 17:27:56 +08:00
</ tr >
< tr >
2003-11-14 18:28:17 +08:00
< ? php if ( $mode == " stream " ) { ?>
2004-01-07 20:57:07 +08:00
< td align = " center " class = " text " >< a href = " javascript: refreshWindow(); " >< ? = $zmSlangReplay ?> </a></td>
2004-01-08 18:09:35 +08:00
< ? php } elseif ( $paged && ! empty ( $page ) ) { ?>
2004-03-10 22:23:22 +08:00
< td align = " center " class = " text " >< a href = " <?= $PHP_SELF ?>?view=event&mode=still&eid=<?= $eid ?><?= $filter_query ?><?= $sort_query ?>&page=0 " >< ? = $zmSlangAll ?> </a></td>
2004-01-08 18:09:35 +08:00
< ? php } elseif ( $paged && empty ( $page ) ) { ?>
2004-03-10 22:23:22 +08:00
< td align = " center " class = " text " >< a href = " <?= $PHP_SELF ?>?view=event&mode=still&eid=<?= $eid ?><?= $filter_query ?><?= $sort_query ?>&page=1 " >< ? = $zmSlangPaged ?> </a></td>
2003-11-14 18:28:17 +08:00
< ? php } else { ?>
< td align = " center " class = " text " >& nbsp ; </ td >
< ? php } ?>
2004-03-10 22:23:22 +08:00
< td align = " center " class = " text " >< ? php if ( canEdit ( 'Events' ) ) { ?> <a href="<?= $PHP_SELF ?>?view=none&action=delete&mark_eid=<?= $eid ?>"><?= $zmSlangDelete ?></a><?php } else { ?> <?php } ?></td>
2004-01-08 18:09:35 +08:00
< ? php if ( $event [ 'Archived' ] ) { ?>
2004-03-15 18:03:30 +08:00
< td align = " center " class = " text " >< ? php if ( canEdit ( 'Events' ) ) { ?> <a href="<?= $PHP_SELF ?>?view=<?= $view ?>&action=unarchive&eid=<?= $eid ?><?= $filter_query ?><?= $sort_query ?>"><?= $zmSlangUnarchive ?></a><?php } else { ?> <?php } ?></td>
2003-07-11 17:27:56 +08:00
< ? php } else { ?>
2004-03-15 18:03:30 +08:00
< td align = " center " class = " text " >< ? php if ( canEdit ( 'Events' ) ) { ?> <a href="<?= $PHP_SELF ?>?view=<?= $view ?>&action=archive&eid=<?= $eid ?><?= $filter_query ?><?= $sort_query ?>"><?= $zmSlangArchive ?></a><?php } else { ?> <?php } ?></td>
2003-07-11 17:27:56 +08:00
< ? php } ?>
< ? php if ( $mode == " stream " ) { ?>
2004-03-10 22:23:22 +08:00
< td align = " center " class = " text " >< a href = " <?= $PHP_SELF ?>?view=event&mode=still&eid=<?= $eid ?><?= $filter_query ?><?= $sort_query ?>&page=1 " >< ? = $zmSlangStills ?> </a></td>
2003-07-11 17:27:56 +08:00
< ? php } elseif ( canStream () ) { ?>
2004-03-10 22:23:22 +08:00
< td align = " center " class = " text " >< a href = " <?= $PHP_SELF ?>?view=event&mode=stream&eid=<?= $eid ?><?= $filter_query ?><?= $sort_query ?> " >< ? = $zmSlangStream ?> </a></td>
2003-07-11 17:27:56 +08:00
< ? php } else { ?>
< td align = " center " class = " text " >& nbsp ; </ td >
< ? php } ?>
< ? php if ( ZM_OPT_MPEG != " no " ) { ?>
2004-01-08 18:09:35 +08:00
< td align = " center " class = " text " >< a href = " javascript: newWindow( '<?= $PHP_SELF ?>?view=video&eid=<?= $eid ?>', 'zmVideo', <?= $jws['video'] ['w']+ $event['Width'] ?>, <?= $jws['video'] ['h']+ $event['Height'] ?> ); " >< ? = $zmSlangVideo ?> </a></td>
2003-07-11 17:27:56 +08:00
< ? php } else { ?>
< td align = " center " class = " text " >& nbsp ; </ td >
< ? php } ?>
2004-01-07 20:57:07 +08:00
< td align = " right " class = " text " >< a href = " javascript: closeWindow(); " >< ? = $zmSlangClose ?> </a></td>
2003-07-11 17:27:56 +08:00
</ tr >
2003-11-14 18:28:17 +08:00
< ? php
2004-01-08 19:45:57 +08:00
if ( $mode == " still " && $paged && ! empty ( $page ) )
{
2003-11-14 18:28:17 +08:00
?>
< ? php
2004-01-08 19:45:57 +08:00
$pages = ( int ) ceil ( $event [ 'Frames' ] / $frames_per_page );
$max_shortcuts = 5 ;
2003-11-14 18:28:17 +08:00
?>
< tr >< td colspan = " 6 " align = " center " class = " text " >
< ? php
2004-01-08 19:45:57 +08:00
if ( $page < 0 )
$page = 1 ;
if ( $page > $pages )
$page = $pages ;
2003-11-14 18:28:17 +08:00
2004-01-08 19:45:57 +08:00
if ( $page > 1 )
{
$new_pages = array ();
$pages_used = array ();
$lo_exp = max ( 2 , log ( $page - 1 ) / log ( $max_shortcuts ));
for ( $i = 0 ; $i < $max_shortcuts ; $i ++ )
2003-11-14 18:28:17 +08:00
{
2004-01-08 19:45:57 +08:00
$new_page = round ( $page - pow ( $lo_exp , $i ));
if ( isset ( $pages_used [ $new_page ]) )
continue ;
if ( $new_page <= 1 )
break ;
$pages_used [ $new_page ] = true ;
array_unshift ( $new_pages , $new_page );
}
if ( ! isset ( $pages_used [ 1 ]) )
array_unshift ( $new_pages , 1 );
2003-11-14 18:28:17 +08:00
2004-01-08 19:45:57 +08:00
foreach ( $new_pages as $new_page )
{
2003-11-14 18:28:17 +08:00
?>
2004-03-10 22:23:22 +08:00
< a href = " <?= $PHP_SELF ?>?view=event&mode=still&eid=<?= $eid ?><?= $filter_query ?><?= $sort_query ?>&page=<?= $new_page ?> " >< ? = $new_page ?> </a>
2003-11-14 18:28:17 +08:00
< ? php
}
2004-01-08 19:45:57 +08:00
}
2003-11-14 18:28:17 +08:00
?>
-& nbsp ; < ? = $page ?> -
< ? php
2004-01-08 19:45:57 +08:00
if ( $page < $pages )
{
$new_pages = array ();
$pages_used = array ();
$hi_exp = max ( 2 , log ( $pages - $page ) / log ( $max_shortcuts ));
for ( $i = 0 ; $i < $max_shortcuts ; $i ++ )
2003-11-14 18:28:17 +08:00
{
2004-01-08 19:45:57 +08:00
$new_page = round ( $page + pow ( $hi_exp , $i ));
if ( isset ( $pages_used [ $new_page ]) )
continue ;
if ( $new_page > $pages )
break ;
$pages_used [ $new_page ] = true ;
array_push ( $new_pages , $new_page );
}
if ( ! isset ( $pages_used [ $pages ]) )
array_push ( $new_pages , $pages );
2003-11-14 18:28:17 +08:00
2004-01-08 19:45:57 +08:00
foreach ( $new_pages as $new_page )
{
2003-11-14 18:28:17 +08:00
?>
2004-03-10 22:23:22 +08:00
& nbsp ; < a href = " <?= $PHP_SELF ?>?view=event&mode=still&eid=<?= $eid ?><?= $filter_query ?><?= $sort_query ?>&page=<?= $new_page ?> " >< ? = $new_page ?> </a>
2003-11-14 18:28:17 +08:00
< ? php
}
2004-01-08 19:45:57 +08:00
}
2003-11-14 18:28:17 +08:00
?>
</ td ></ tr >
< ? php
2004-01-08 19:45:57 +08:00
}
2003-11-14 18:28:17 +08:00
?>
2003-07-11 17:27:56 +08:00
< ? php
2004-01-08 19:45:57 +08:00
if ( $mode == " stream " )
{
2004-03-04 23:05:54 +08:00
?>
< tr >< td colspan = " 6 " align = " center " valign = " middle " >
< ? php
2004-03-15 07:27:36 +08:00
if ( ZM_VIDEO_STREAM_METHOD == 'mpeg' && ZM_VIDEO_REPLAY_FORMAT )
2003-07-11 17:27:56 +08:00
{
2004-04-19 19:23:40 +08:00
$stream_src = ZM_PATH_ZMS . " ?mode=mpeg&event= $eid &scale= $scale &rate= $rate &bitrate= " . ZM_WEB_VIDEO_BITRATE . " &maxfps= " . ZM_WEB_VIDEO_MAXFPS . " &format= " . ZM_VIDEO_REPLAY_FORMAT ;
2004-03-04 23:05:54 +08:00
if ( isWindows () )
{
if ( isInternetExplorer () )
{
?>
2004-08-11 22:27:15 +08:00
< object id = " MediaPlayer1 " width = " <?= reScale( $event['Width'] , $scale ) ?> " height = " <?= reScale( $event['Height'] , $scale ) ?> "
2004-03-04 23:05:54 +08:00
classid = " CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95 "
codebase = " http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902 "
standby = " Loading Microsoft Windows Media Player components... "
type = " application/x-oleobject " >
2004-08-11 22:27:15 +08:00
< param name = " FileName " value = " <?= $stream_src ?> " >
< param name = " animationatStart " value = " true " >
< param name = " transparentatStart " value = " true " >
< param name = " autoStart " value = " true " >
< param name = " showControls " value = " false " >
</ object >
2004-03-04 23:05:54 +08:00
< ? php
}
else
{
2003-07-11 17:27:56 +08:00
?>
2004-08-11 22:27:15 +08:00
< embed type = " application/x-mplayer2 "
2004-03-04 23:05:54 +08:00
pluginspage = " http://www.microsoft.com/Windows/MediaPlayer/ "
2004-08-11 22:27:15 +08:00
src = " <?= $stream_src ?> "
2004-03-04 23:05:54 +08:00
name = " MediaPlayer1 "
2004-08-11 22:27:15 +08:00
width = " <?= reScale( $event['Width'] , $scale ) ?> "
height = " <?= reScale( $event['Height'] , $scale ) ?> "
autostart = " true " >
</ embed >
2003-07-11 17:27:56 +08:00
< ? php
2004-03-04 23:05:54 +08:00
}
}
else
{
?>
2004-08-11 22:27:15 +08:00
< embed type = " video/mpeg "
2004-03-15 07:27:36 +08:00
src = " <?= $stream_src ?> "
2004-08-11 22:27:15 +08:00
width = " <?= reScale( $event['Width'] , $scale ) ?> "
height = " <?= reScale( $event['Height'] , $scale ) ?> "
autostart = " true " >
</ embed >
2004-03-04 23:05:54 +08:00
< ? php
}
2004-01-08 19:45:57 +08:00
}
else
{
2004-04-19 19:23:40 +08:00
$stream_src = ZM_PATH_ZMS . " ?mode=jpeg&event= $eid &scale= $scale &rate= $rate &maxfps= " . ZM_WEB_VIDEO_MAXFPS ;
2004-03-04 23:05:54 +08:00
if ( canStreamNative () )
{
?>
< img src = " <?= $stream_src ?> " border = " 0 " width = " <?= reScale( $event['Width'] , $scale ) ?> " height = " <?= reScale( $event['Height'] , $scale ) ?> " >
< ? php
}
else
{
2003-07-11 17:27:56 +08:00
?>
2004-03-04 23:05:54 +08:00
< applet code = " com.charliemouse.cambozola.Viewer " archive = " <?= ZM_PATH_CAMBOZOLA ?> " align = " middle " width = " <?= reScale( $event['Width'] , $scale ) ?> " height = " <?= reScale( $event['Height'] , $scale ) ?> " >< param name = " url " value = " <?= $stream_src ?> " ></ applet >
2003-07-11 17:27:56 +08:00
< ? php
2004-03-04 23:05:54 +08:00
}
2003-07-11 17:27:56 +08:00
}
2004-03-04 23:05:54 +08:00
?>
</ td ></ tr >
< ? php
2004-01-08 19:45:57 +08:00
}
else
{
if ( $paged && ! empty ( $page ) )
2004-03-04 23:13:10 +08:00
{
$lo_frame_id = (( $page - 1 ) * $frames_per_page ) + 1 ;
$hi_frame_id = min ( $page * $frames_per_page , $event [ 'Frames' ] );
}
else
{
2004-03-05 18:31:54 +08:00
$lo_frame_id = 1 ;
$hi_frame_id = $event [ 'Frames' ];
2004-03-04 23:13:10 +08:00
}
2004-08-11 22:27:15 +08:00
$sql = " select * from Frames where EventId = ' $eid ' " ;
2004-03-04 23:13:10 +08:00
if ( $paged && ! empty ( $page ) )
$sql .= " and FrameId between $lo_frame_id and $hi_frame_id " ;
2004-03-05 18:31:54 +08:00
$sql .= " order by FrameId " ;
2004-01-08 19:45:57 +08:00
$result = mysql_query ( $sql );
if ( ! $result )
die ( mysql_error () );
2004-03-04 23:13:10 +08:00
$alarm_frames = array ();
while ( $row = mysql_fetch_assoc ( $result ) )
{
if ( $row [ 'Type' ] == 'Alarm' )
{
$alarm_frames [ $row [ 'FrameId' ]] = $row ;
}
}
2003-07-11 17:27:56 +08:00
?>
< tr >< td colspan = " 6 " >< table border = " 0 " cellpadding = " 0 " cellspacing = " 2 " align = " center " >
< tr >
< ? php
2004-01-08 19:45:57 +08:00
$count = 0 ;
2004-04-19 19:23:40 +08:00
$scale = ZM_WEB_IMAGE_SCALING ;
2004-01-08 19:45:57 +08:00
$fraction = sprintf ( " %.2f " , 1 / $scale );
2004-09-23 20:06:21 +08:00
$thumb_width = $event [ 'Width' ] / ZM_WEB_FRAMES_PER_LINE ;
$thumb_height = $event [ 'Height' ] / ZM_WEB_FRAMES_PER_LINE ;
2004-09-07 16:45:00 +08:00
$event_path = ZM_DIR_EVENTS . '/' . $event [ 'MonitorId' ] . '/' . $event [ 'Id' ];
2004-03-05 18:31:54 +08:00
for ( $frame_id = $lo_frame_id ; $frame_id <= $hi_frame_id ; $frame_id ++ )
2004-01-08 19:45:57 +08:00
{
2004-03-22 18:33:40 +08:00
$image_path = sprintf ( " %s/%0 " . ZM_EVENT_IMAGE_DIGITS . " d-capture.jpg " , $event_path , $frame_id );
2004-01-08 19:45:57 +08:00
$capt_image = $image_path ;
if ( $scale == 1 || ! file_exists ( ZM_PATH_NETPBM . " /jpegtopnm " ) )
2003-07-11 17:27:56 +08:00
{
2004-01-08 19:45:57 +08:00
$anal_image = preg_replace ( " /capture/ " , " analyse " , $image_path );
2003-07-11 17:27:56 +08:00
2004-01-08 19:45:57 +08:00
if ( file_exists ( $anal_image ) && filesize ( $anal_image ) )
2003-07-11 17:27:56 +08:00
{
2004-01-08 19:45:57 +08:00
$thumb_image = $anal_image ;
2003-07-11 17:27:56 +08:00
}
else
{
2004-01-08 19:45:57 +08:00
$thumb_image = $capt_image ;
}
}
else
{
$thumb_image = preg_replace ( " /capture/ " , " thumb " , $capt_image );
2003-07-11 17:27:56 +08:00
2004-01-08 19:45:57 +08:00
if ( ! file_exists ( $thumb_image ) || ! filesize ( $thumb_image ) )
{
$anal_image = preg_replace ( " /capture/ " , " analyse " , $capt_image );
if ( file_exists ( $anal_image ) )
$command = ZM_PATH_NETPBM . " /jpegtopnm -dct fast $anal_image | " . ZM_PATH_NETPBM . " /pnmscalefixed $fraction | " . ZM_PATH_NETPBM . " /ppmtojpeg --dct=fast > $thumb_image " ;
else
$command = ZM_PATH_NETPBM . " /jpegtopnm -dct fast $capt_image | " . ZM_PATH_NETPBM . " /pnmscalefixed $fraction | " . ZM_PATH_NETPBM . " /ppmtojpeg --dct=fast > $thumb_image " ;
#exec( escapeshellcmd( $command ) );
exec ( $command );
2003-07-11 17:27:56 +08:00
}
2004-01-08 19:45:57 +08:00
}
2004-03-04 23:13:10 +08:00
$alarm_frame = $alarm_frames [ $frame_id ];
$img_class = $alarm_frame ? " alarm " : " normal " ;
2003-07-11 17:27:56 +08:00
?>
2004-03-10 22:23:22 +08:00
< td align = " center " width = " 88 " >< a href = " javascript: newWindow( '<?= $PHP_SELF ?>?view=frame&eid=<?= $eid ?>&fid=<?= $frame_id ?>', 'zmImage', <?= $event['Width'] + $jws['image'] ['w'] ?>, <?= $event['Height'] + $jws['image'] ['h'] ?> ); " >< img src = " <?= $thumb_image ?> " width = " <?= $thumb_width ?> " height = " <?= $thumb_height ?> " class = " <?= $img_class ?> " alt = " <?= $frame_id ?>/<?= $alarm_frame ? $alarm_frame['Score'] :0 ?> " ></ a ></ td >
2003-07-11 17:27:56 +08:00
< ? php
2004-01-08 19:45:57 +08:00
flush ();
2004-09-23 20:06:21 +08:00
if ( ! ( ++ $count % ZM_WEB_FRAMES_PER_LINE ) )
2004-01-08 19:45:57 +08:00
{
2003-07-11 17:27:56 +08:00
?>
</ tr >
< tr >
< ? php
}
2004-01-08 19:45:57 +08:00
}
2003-07-11 17:27:56 +08:00
?>
</ tr >
</ table ></ td ></ tr >
< ? php
2004-01-08 19:45:57 +08:00
}
2003-07-11 17:27:56 +08:00
?>
< tr >
< td colspan = " 6 " >< table width = " 100% " cellpadding = " 0 " cellspacing = " 0 " border = " 0 " >< tr >
2004-04-21 17:20:28 +08:00
< td width = " 25% " align = " center " class = " text " >< ? php if ( $prev_event ) { ?> <a href="<?= $PHP_SELF ?>?view=<?= $view ?>&mode=<?= $mode ?>&eid=<?= $prev_event['Id'] ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?>&page=<?= $page ?>&rate=<?= $rate ?>&scale=<?= $scale ?>"><?= $zmSlangPrev ?></a><?php } else { ?> <?php } ?></td>
< td width = " 25% " align = " center " class = " text " >< ? php if ( canEdit ( 'Events' ) && $prev_event ) { ?> <a href="<?= $PHP_SELF ?>?view=<?= $view ?>&mode=<?= $mode ?>&eid=<?= $prev_event['Id'] ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?>&action=delete&mark_eid=<?= $eid ?>&page=<?= $page ?>&rate=<?= $rate ?>&scale=<?= $scale ?>"><?= $zmSlangDeleteAndPrev ?></a><?php } else { ?> <?php } ?></td>
< td width = " 25% " align = " center " class = " text " >< ? php if ( canEdit ( 'Events' ) && $next_event ) { ?> <a href="<?= $PHP_SELF ?>?view=<?= $view ?>&mode=<?= $mode ?>&eid=<?= $next_event['Id'] ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?>&action=delete&mark_eid=<?= $eid ?>&page=<?= $page ?>&rate=<?= $rate ?>&scale=<?= $scale ?>"><?= $zmSlangDeleteAndNext ?></a><?php } else { ?> <?php } ?></td>
< td width = " 25% " align = " center " class = " text " >< ? php if ( $next_event ) { ?> <a href="<?= $PHP_SELF ?>?view=<?= $view ?>&mode=<?= $mode ?>&eid=<?= $next_event['Id'] ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?>&page=<?= $page ?>&rate=<?= $rate ?>&scale=<?= $scale ?>"><?= $zmSlangNext ?></a><?php } else { ?> <?php } ?></td>
2003-07-11 17:27:56 +08:00
</ tr ></ table ></ td >
</ tr >
</ table >
</ body >
</ html >