From e4b1f8a64e721d57b30715a8a21aeaa63a7af1b7 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Fri, 23 Jan 2015 11:57:31 -0500 Subject: [PATCH] Add API function for getting Event's path --- web/api/app/Controller/Component/ImageComponent.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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']) ); + } } ?>