use storage area paths in getting analyze images and frame stills

This commit is contained in:
Isaac Connor 2016-02-19 09:46:56 -05:00
parent 68babd783b
commit e2d892961b
1 changed files with 8 additions and 4 deletions

View File

@ -516,6 +516,7 @@ function canEdit( $area, $mid=false )
function getEventPath( $event ) function getEventPath( $event )
{ {
if ( ZM_USE_DEEP_STORAGE ) if ( ZM_USE_DEEP_STORAGE )
$eventPath = $event['MonitorId'].'/'.strftime( "%y/%m/%d/%H/%M/%S", strtotime($event['StartTime']) ); $eventPath = $event['MonitorId'].'/'.strftime( "%y/%m/%d/%H/%M/%S", strtotime($event['StartTime']) );
else else
@ -1146,7 +1147,9 @@ function zmaCheck( $monitor )
function getImageSrc( $event, $frame, $scale=SCALE_BASE, $captureOnly=false, $overwrite=false ) function getImageSrc( $event, $frame, $scale=SCALE_BASE, $captureOnly=false, $overwrite=false )
{ {
require_once('includes/Storage.php');
$eventPath = getEventPath( $event ); $eventPath = getEventPath( $event );
$Storage = new Storage( $event['StorageId'] );
if ( !is_array($frame) ) if ( !is_array($frame) )
$frame = array( 'FrameId'=>$frame, 'Type'=>'' ); $frame = array( 'FrameId'=>$frame, 'Type'=>'' );
@ -1159,7 +1162,8 @@ function getImageSrc( $event, $frame, $scale=SCALE_BASE, $captureOnly=false, $ov
$analImage = sprintf( "%0".ZM_EVENT_IMAGE_DIGITS."d-analyse.jpg", $frame['FrameId'] ); $analImage = sprintf( "%0".ZM_EVENT_IMAGE_DIGITS."d-analyse.jpg", $frame['FrameId'] );
$analPath = $eventPath.'/'.$analImage; $analPath = $eventPath.'/'.$analImage;
$analFile = ZM_DIR_EVENTS."/".$analPath;
$analFile = $Storage->Path()."/".$analPath;
$thumbAnalPath = ZM_DIR_IMAGES.'/'.$event['Id'].'-'.$analImage; $thumbAnalPath = ZM_DIR_IMAGES.'/'.$event['Id'].'-'.$analImage;
//echo "AI:$analImage, AP:$analPath, TAP:$thumbAnalPath<br>"; //echo "AI:$analImage, AP:$analPath, TAP:$thumbAnalPath<br>";
@ -1171,8 +1175,8 @@ function getImageSrc( $event, $frame, $scale=SCALE_BASE, $captureOnly=false, $ov
if ( !ZM_WEB_SCALE_THUMBS || $scale >= SCALE_BASE || !function_exists( 'imagecreatefromjpeg' ) ) if ( !ZM_WEB_SCALE_THUMBS || $scale >= SCALE_BASE || !function_exists( 'imagecreatefromjpeg' ) )
{ {
$imagePath = $thumbPath = $isAnalImage?$analPath:$captPath; $imagePath = $thumbPath = $isAnalImage?$analPath:$captPath;
$imageFile = ZM_DIR_EVENTS."/".$imagePath; $imageFile = $Storage->Path()."/".$imagePath;
$thumbFile = ZM_DIR_EVENTS."/".$thumbPath; $thumbFile = $Storage->Path()."/".$thumbPath;
} }
else else
{ {
@ -1196,7 +1200,7 @@ function getImageSrc( $event, $frame, $scale=SCALE_BASE, $captureOnly=false, $ov
$thumbPath = $thumbCaptPath; $thumbPath = $thumbCaptPath;
} }
$imageFile = ZM_DIR_EVENTS."/".$imagePath; $imageFile = $Storage->Path()."/".$imagePath;
//$thumbFile = ZM_DIR_EVENTS."/".$thumbPath; //$thumbFile = ZM_DIR_EVENTS."/".$thumbPath;
$thumbFile = $thumbPath; $thumbFile = $thumbPath;
if ( $overwrite || !file_exists( $thumbFile ) || !filesize( $thumbFile ) ) if ( $overwrite || !file_exists( $thumbFile ) || !filesize( $thumbFile ) )