diff --git a/web/includes/Event.php b/web/includes/Event.php
index 7e038397a..fc0557ba0 100644
--- a/web/includes/Event.php
+++ b/web/includes/Event.php
@@ -417,31 +417,27 @@ class Event extends ZM_Object {
}
} // 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");
}
- //echo "CI:$captImage, CP:$captPath, TCP:$captPath
";
-
$analImage = sprintf('%0'.ZM_EVENT_IMAGE_DIGITS.'d-analyse.jpg', $frame['FrameId']);
$analPath = $eventPath.'/'.$analImage;
- //echo "AI:$analImage, AP:$analPath, TAP:$analPath
";
-
$alarmFrame = $frame['Type']=='Alarm';
$hasAnalImage = $alarmFrame && file_exists($analPath) && filesize($analPath);
$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') ) {
$imagePath = $thumbPath = $isAnalImage ? $analPath : $captPath;
$imageFile = $imagePath;
$thumbFile = $thumbPath;
} else {
- if ( version_compare( phpversion(), '4.3.10', '>=') )
+ if ( version_compare(phpversion(), '4.3.10', '>=') )
$fraction = sprintf('%.3F', $scale/SCALE_BASE);
else
$fraction = sprintf('%.3f', $scale/SCALE_BASE);
@@ -459,19 +455,19 @@ class Event extends ZM_Object {
}
$thumbFile = $thumbPath;
- if ( $overwrite || ! file_exists( $thumbFile ) || ! filesize( $thumbFile ) ) {
+ 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;
// Resample
- $thumbImage = imagecreatetruecolor( $thumbWidth, $thumbHeight );
- $image = imagecreatefromjpeg( $imagePath );
- imagecopyresampled( $thumbImage, $image, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imageWidth, $imageHeight );
+ $thumbImage = imagecreatetruecolor($thumbWidth, $thumbHeight);
+ $image = imagecreatefromjpeg($imagePath);
+ imagecopyresampled($thumbImage, $image, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imageWidth, $imageHeight);
- if ( !imagejpeg( $thumbImage, $thumbPath ) )
- Error( "Can't create thumbnail '$thumbPath'" );
+ if ( !imagejpeg($thumbImage, $thumbPath) )
+ Error("Can't create thumbnail '$thumbPath'");
}
} # Create thumbnails
@@ -554,7 +550,7 @@ class Event extends ZM_Object {
$Server = $Storage->ServerId() ? $Storage->Server() : $this->Monitor()->Server();
if ( $Server->Id() != ZM_SERVER_ID ) {
- $url = $Server->UrlToApi() . '/events/'.$this->{'Id'}.'.json';
+ $url = $Server->UrlToApi().'/events/'.$this->{'Id'}.'.json';
if ( ZM_OPT_USE_AUTH ) {
if ( ZM_AUTH_RELAY == 'hashed' ) {
$url .= '?auth='.generateAuthHash( ZM_AUTH_HASH_IPS );