remove debug and spacing

pull/2863/head
Isaac Connor 2020-02-25 11:08:23 -05:00
parent cc7de97b6a
commit 6cf448c74e
1 changed files with 11 additions and 15 deletions

View File

@ -417,31 +417,27 @@ class Event extends ZM_Object {
} }
} // end if capture file exists } // end if capture file exists
} // end if analyze file exists } // end if analyze file exists
} } // end if frame or snapshot
$captPath = $eventPath.'/'.$captImage; $captPath = $eventPath.'/'.$captImage;
if ( ! file_exists($captPath) ) { if ( ! file_exists($captPath) ) {
Error("Capture file does not exist at $captPath"); Error("Capture file does not exist at $captPath");
} }
//echo "CI:$captImage, CP:$captPath, TCP:$captPath<br>";
$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;
//echo "AI:$analImage, AP:$analPath, TAP:$analPath<br>";
$alarmFrame = $frame['Type']=='Alarm'; $alarmFrame = $frame['Type']=='Alarm';
$hasAnalImage = $alarmFrame && file_exists($analPath) && filesize($analPath); $hasAnalImage = $alarmFrame && file_exists($analPath) && filesize($analPath);
$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') ) {
$imagePath = $thumbPath = $isAnalImage ? $analPath : $captPath; $imagePath = $thumbPath = $isAnalImage ? $analPath : $captPath;
$imageFile = $imagePath; $imageFile = $imagePath;
$thumbFile = $thumbPath; $thumbFile = $thumbPath;
} else { } else {
if ( version_compare( phpversion(), '4.3.10', '>=') ) if ( version_compare(phpversion(), '4.3.10', '>=') )
$fraction = sprintf('%.3F', $scale/SCALE_BASE); $fraction = sprintf('%.3F', $scale/SCALE_BASE);
else else
$fraction = sprintf('%.3f', $scale/SCALE_BASE); $fraction = sprintf('%.3f', $scale/SCALE_BASE);
@ -459,19 +455,19 @@ class Event extends ZM_Object {
} }
$thumbFile = $thumbPath; $thumbFile = $thumbPath;
if ( $overwrite || ! file_exists( $thumbFile ) || ! filesize( $thumbFile ) ) { if ( $overwrite || ! file_exists($thumbFile) || ! filesize($thumbFile) ) {
// Get new dimensions // Get new dimensions
list( $imageWidth, $imageHeight ) = getimagesize( $imagePath ); list( $imageWidth, $imageHeight ) = getimagesize($imagePath);
$thumbWidth = $imageWidth * $fraction; $thumbWidth = $imageWidth * $fraction;
$thumbHeight = $imageHeight * $fraction; $thumbHeight = $imageHeight * $fraction;
// Resample // Resample
$thumbImage = imagecreatetruecolor( $thumbWidth, $thumbHeight ); $thumbImage = imagecreatetruecolor($thumbWidth, $thumbHeight);
$image = imagecreatefromjpeg( $imagePath ); $image = imagecreatefromjpeg($imagePath);
imagecopyresampled( $thumbImage, $image, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imageWidth, $imageHeight ); imagecopyresampled($thumbImage, $image, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imageWidth, $imageHeight);
if ( !imagejpeg( $thumbImage, $thumbPath ) ) if ( !imagejpeg($thumbImage, $thumbPath) )
Error( "Can't create thumbnail '$thumbPath'" ); Error("Can't create thumbnail '$thumbPath'");
} }
} # Create thumbnails } # Create thumbnails
@ -554,7 +550,7 @@ class Event extends ZM_Object {
$Server = $Storage->ServerId() ? $Storage->Server() : $this->Monitor()->Server(); $Server = $Storage->ServerId() ? $Storage->Server() : $this->Monitor()->Server();
if ( $Server->Id() != ZM_SERVER_ID ) { 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_OPT_USE_AUTH ) {
if ( ZM_AUTH_RELAY == 'hashed' ) { if ( ZM_AUTH_RELAY == 'hashed' ) {
$url .= '?auth='.generateAuthHash( ZM_AUTH_HASH_IPS ); $url .= '?auth='.generateAuthHash( ZM_AUTH_HASH_IPS );