Merge branch 'master' of github.com:ZoneMinder/zoneminder
commit
4c984c3617
|
@ -57,6 +57,7 @@ $filename = '';
|
|||
$Frame = null;
|
||||
$Event = null;
|
||||
$path = null;
|
||||
$image_type='image/jpeg';
|
||||
|
||||
if ( empty($_REQUEST['path']) ) {
|
||||
|
||||
|
@ -77,6 +78,35 @@ if ( empty($_REQUEST['path']) ) {
|
|||
}
|
||||
|
||||
if ( $_REQUEST['fid'] == 'objdetect' ) {
|
||||
// if animation file is found, return that, else return image
|
||||
$path_anim = $Event->Path().'/objdetect.gif';
|
||||
$path_image = $Event->Path().'/objdetect.jpg';
|
||||
if ( file_exists($path_anim)) {
|
||||
// we found the animation/gif file
|
||||
$path = $path_anim;
|
||||
ZM\Logger::Debug("Animation file found at $path");
|
||||
$image_type = 'image/gif';
|
||||
} else if (file_exists($path_image)) {
|
||||
// animation/gif not found, but image found
|
||||
ZM\Logger::Debug("Image file found at $path");
|
||||
$path = $path_image;
|
||||
} else {
|
||||
// neither animation/gif nor image found
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
ZM\Fatal("Object detection animation and image not found for this event");
|
||||
}
|
||||
$Frame = new ZM\Frame();
|
||||
$Frame->Id('objdetect');
|
||||
} else if ( $_REQUEST['fid'] == 'objdetectanim' ) {
|
||||
$path = $Event->Path().'/objdetect.gif';
|
||||
if ( !file_exists($path) ) {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
ZM\Fatal("File $path does not exist. You might not have enabled GIF creation in objectconfig.ini. If you have, inspect debug logs for errors during creation");
|
||||
}
|
||||
$Frame = new ZM\Frame();
|
||||
$Frame->Id('objdetect');
|
||||
$image_type = 'image/gif';
|
||||
} else if ( $_REQUEST['fid'] == 'objdetectimage' ) {
|
||||
$path = $Event->Path().'/objdetect.jpg';
|
||||
if ( !file_exists($path) ) {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
|
@ -281,7 +311,7 @@ if ( !empty($_REQUEST['height']) ) {
|
|||
if ( $errorText ) {
|
||||
ZM\Error($errorText);
|
||||
} else {
|
||||
header('Content-type: image/jpeg');
|
||||
header("Content-type: $image_type");
|
||||
if ( ( $scale==0 || $scale==100 ) && ($width==0) && ($height==0) ) {
|
||||
# This is so that Save Image As give a useful filename
|
||||
if ( $Event ) {
|
||||
|
|
Loading…
Reference in New Issue