diff --git a/web/api/app/Controller/Component/ImageComponent.php b/web/api/app/Controller/Component/ImageComponent.php index def1f4e46..147a26dd7 100644 --- a/web/api/app/Controller/Component/ImageComponent.php +++ b/web/api/app/Controller/Component/ImageComponent.php @@ -3,7 +3,7 @@ App::uses('Component', 'Controller'); class ImageComponent extends Component { public function getImageSrc( $event, $frame, $scale, $config ) { - $eventPath = $event['Event']['MonitorId'].'/'.strftime( "%y/%m/%d/%H/%M/%S", strtotime($event['Event']['StartTime']) ); + $eventPath = $this->getEventPath($event); $captImage = sprintf( "%0".$config['ZM_EVENT_IMAGE_DIGITS']."d-capture.jpg", $frame['Frame']['FrameId'] ); $captPath = $eventPath.'/'.$captImage; @@ -79,5 +79,11 @@ class ImageComponent extends Component { return( $imageData ); } + + // Take the StartTime of an Event and return + // the path to its location on the filesystem + public function getEventPath( $event ) { + return $event['Event']['MonitorId'].'/'.strftime( "%y/%m/%d/%H/%M/%S", strtotime($event['Event']['StartTime']) ); + } } ?>