"graphics/point-g.gif", "hisrc"=>"graphics/point-o.gif", "actsrc"=>"graphics/point-r.gif", "width"=>7, "height"=>7, ); $result = mysql_query( "select * from Monitors where Id = '$mid'" ); if ( !$result ) die( mysql_error() ); $monitor = mysql_fetch_assoc( $result ); $min_x = 0; $max_x = $monitor['Width']-1; $min_y = 0; $max_y = $monitor['Height']-1; if ( $zid > 0 ) { $result = mysql_query( "select * from Zones where MonitorId = '$mid' and Id = '$zid'" ); if ( !$result ) die( mysql_error() ); $zone = mysql_fetch_assoc( $result ); } else { $zone = array(); $zone['Name'] = $zmSlangNew; $zone['CheckMethod'] = 'Blobs'; $zone['AlarmRGB'] = 0xff0000; $zone['NumCoords'] = 4; $zone['Coords'] = sprintf( "%d,%d %d,%d, %d,%d %d,%d", $min_x, $min_y, $max_x, $min_y, $max_x, $max_y, $min_x, $max_y ); $zone['Area'] = $monitor['Width'] * $monitor['Height']; } $zone['Points'] = coordsToPoints( $zone['Coords'] ); $new_zone = $zone; if ( !$points ) { $points = $zone['Points']; } ksort( $points, SORT_NUMERIC ); if ( $action == "loc_addpoint" ) { if ( $subaction < (count($points)-1) ) { $new_x = intval(round(($points[$subaction]['x']+$points[$subaction+1]['x'])/2)); $new_y = intval(round(($points[$subaction]['y']+$points[$subaction+1]['y'])/2)); } else { $new_x = intval(round(($points[$subaction]['x']+$points[0]['x'])/2)); $new_y = intval(round(($points[$subaction]['y']+$points[0]['y'])/2)); } array_splice( $points, $subaction+1, 0, array( array( 'x'=>$new_x, 'y'=>$new_y ) ) ); } elseif ( $action == "loc_delpoint" ) { array_splice( $points, $subaction, 1 ); } $coords = pointsToCoords( $points ); $area = getPolyArea( $points ); chdir( ZM_DIR_IMAGES ); $command = getZmuCommand( " -m $mid -z" ); if ( !$zid ) $zid = 0; $command .= "\"$zid $hicolor $coords\""; $status = exec( escapeshellcmd( $command ) ); chdir( '..' ); $zone_image = ZM_DIR_IMAGES.'/'.$monitor['Name']."-Zones.jpg?".time(); ?>