Fixed use of analysis images in getImageSrc function plus fixed implementation of overwrite flag in various functions.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@3207 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2010-11-28 21:20:02 +00:00
parent 79e24aef44
commit 6c547aba85
1 changed files with 4 additions and 3 deletions

View File

@ -1105,12 +1105,13 @@ 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;
$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>";
$alarmFrame = $frame['Type']=='Alarm'; $alarmFrame = $frame['Type']=='Alarm';
$hasAnalImage = $alarmFrame && file_exists( $analPath ) && filesize( $analPath ); $hasAnalImage = $alarmFrame && file_exists( $analFile ) && filesize( $analFile );
$isAnalImage = $hasAnalImage && !$captureOnly; $isAnalImage = $hasAnalImage && !$captureOnly;
if ( !ZM_WEB_SCALE_THUMBS || $scale >= SCALE_BASE || !function_exists( 'imagecreatefromjpeg' ) ) if ( !ZM_WEB_SCALE_THUMBS || $scale >= SCALE_BASE || !function_exists( 'imagecreatefromjpeg' ) )
@ -1144,7 +1145,7 @@ function getImageSrc( $event, $frame, $scale=SCALE_BASE, $captureOnly=false, $ov
$imageFile = ZM_DIR_EVENTS."/".$imagePath; $imageFile = ZM_DIR_EVENTS."/".$imagePath;
//$thumbFile = ZM_DIR_EVENTS."/".$thumbPath; //$thumbFile = ZM_DIR_EVENTS."/".$thumbPath;
$thumbFile = $thumbPath; $thumbFile = $thumbPath;
if ( !file_exists( $thumbFile ) || !filesize( $thumbFile ) ) if ( $overwrite || !file_exists( $thumbFile ) || !filesize( $thumbFile ) )
{ {
// Get new dimensions // Get new dimensions
list( $imageWidth, $imageHeight ) = getimagesize( $imageFile ); list( $imageWidth, $imageHeight ) = getimagesize( $imageFile );
@ -1216,7 +1217,7 @@ function createListThumbnail( $event, $overwrite=false )
die( "No thumbnail width or height specified, please check in Options->Web" ); die( "No thumbnail width or height specified, please check in Options->Web" );
} }
$imageData = getImageSrc( $event, $frame, $scale ); $imageData = getImageSrc( $event, $frame, $scale, false, $overwrite );
$thumbData = $frame; $thumbData = $frame;
$thumbData['Path'] = $imageData['thumbPath']; $thumbData['Path'] = $imageData['thumbPath'];
$thumbData['Width'] = (int)$thumbWidth; $thumbData['Width'] = (int)$thumbWidth;