From 204086a56d19916e108b661e57da331bedcbfe57 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 22 Jul 2020 17:28:12 -0400 Subject: [PATCH] spacing and quotes --- web/includes/Event.php | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/web/includes/Event.php b/web/includes/Event.php index f1ba99626..89e41b2ca 100644 --- a/web/includes/Event.php +++ b/web/includes/Event.php @@ -380,54 +380,54 @@ class Event extends ZM_Object { $Event = $this; $eventPath = $Event->Path(); - if ( $frame and ! is_array($frame) ) { + if ( $frame and !is_array($frame) ) { # Must be an Id Logger::Debug("Assuming that $frame is an Id"); - $frame = array( 'FrameId'=>$frame, 'Type'=>'', 'Delta'=>0 ); + $frame = array('FrameId'=>$frame, 'Type'=>'', 'Delta'=>0); } - if ( ( ! $frame ) and file_exists($eventPath.'/snapshot.jpg') ) { + if ( ( !$frame ) and file_exists($eventPath.'/snapshot.jpg') ) { # No frame specified, so look for a snapshot to use $captImage = 'snapshot.jpg'; - Logger::Debug("Frame not specified, using snapshot"); - $frame = array('FrameId'=>'snapshot', 'Type'=>'','Delta'=>0); + Logger::Debug('Frame not specified, using snapshot'); + $frame = array('FrameId'=>'snapshot', 'Type'=>'', 'Delta'=>0); } else { - $captImage = sprintf( '%0'.ZM_EVENT_IMAGE_DIGITS.'d-analyze.jpg', $frame['FrameId'] ); + $captImage = sprintf('%0'.ZM_EVENT_IMAGE_DIGITS.'d-analyze.jpg', $frame['FrameId']); if ( ! file_exists( $eventPath.'/'.$captImage ) ) { - $captImage = sprintf( '%0'.ZM_EVENT_IMAGE_DIGITS.'d-capture.jpg', $frame['FrameId'] ); - if ( ! file_exists( $eventPath.'/'.$captImage ) ) { + $captImage = sprintf('%0'.ZM_EVENT_IMAGE_DIGITS.'d-capture.jpg', $frame['FrameId']); + if ( !file_exists($eventPath.'/'.$captImage) ) { # Generate the frame JPG if ( $Event->DefaultVideo() ) { $videoPath = $eventPath.'/'.$Event->DefaultVideo(); - if ( ! file_exists( $videoPath ) ) { - Error("Event claims to have a video file, but it does not seem to exist at $videoPath" ); + if ( !file_exists($videoPath) ) { + Error('Event claims to have a video file, but it does not seem to exist at '.$videoPath); return ''; } #$command ='ffmpeg -v 0 -i '.$videoPath.' -vf "select=gte(n\\,'.$frame['FrameId'].'),setpts=PTS-STARTPTS" '.$eventPath.'/'.$captImage; $command ='ffmpeg -ss '. $frame['Delta'] .' -i '.$videoPath.' -frames:v 1 '.$eventPath.'/'.$captImage; - Logger::Debug( "Running $command" ); + Logger::Debug('Running '.$command); $output = array(); $retval = 0; - exec( $command, $output, $retval ); + exec($command, $output, $retval); Logger::Debug("Retval: $retval, output: " . implode("\n", $output)); } else { - Error("Can't create frame images from video because there is no video file for event ".$Event->Id().' at ' .$Event->Path() ); + Error('Can\'t create frame images from video because there is no video file for event '.$Event->Id().' at ' .$Event->Path()); } } // end if capture file exists } // end if analyze file exists } // end if frame or snapshot $captPath = $eventPath.'/'.$captImage; - if ( ! file_exists($captPath) ) { - Error("Capture file does not exist at $captPath"); + if ( !file_exists($captPath) ) { + Error('Capture file does not exist at '.$captPath); } $analImage = sprintf('%0'.ZM_EVENT_IMAGE_DIGITS.'d-analyse.jpg', $frame['FrameId']); $analPath = $eventPath.'/'.$analImage; - $alarmFrame = $frame['Type']=='Alarm'; + $alarmFrame = $frame['Type'] == 'Alarm'; $hasAnalImage = $alarmFrame && file_exists($analPath) && filesize($analPath); $isAnalImage = $hasAnalImage && !$captureOnly; @@ -443,8 +443,8 @@ class Event extends ZM_Object { $fraction = sprintf('%.3f', $scale/SCALE_BASE); $scale = (int)round($scale); - $thumbCaptPath = preg_replace( '/\.jpg$/', "-$scale.jpg", $captPath ); - $thumbAnalPath = preg_replace( '/\.jpg$/', "-$scale.jpg", $analPath ); + $thumbCaptPath = preg_replace('/\.jpg$/', "-$scale.jpg", $captPath); + $thumbAnalPath = preg_replace('/\.jpg$/', "-$scale.jpg", $analPath); if ( $isAnalImage ) { $imagePath = $analPath; @@ -457,7 +457,7 @@ class Event extends ZM_Object { $thumbFile = $thumbPath; if ( $overwrite || ! file_exists($thumbFile) || ! filesize($thumbFile) ) { // Get new dimensions - list( $imageWidth, $imageHeight ) = getimagesize($imagePath); + list($imageWidth, $imageHeight) = getimagesize($imagePath); $thumbWidth = $imageWidth * $fraction; $thumbHeight = $imageHeight * $fraction; @@ -484,7 +484,7 @@ class Event extends ZM_Object { ); return $imageData; - } + } # getImageSrc public function link_to($text=null) { if ( !$text )