Added options to render objdetect, objdetectanim and objdetectimage

pull/2881/head
Pliable Pixels 2020-03-10 13:51:55 -04:00
parent 0f741d0e1c
commit 49f23cb35b
1 changed files with 30 additions and 10 deletions

View File

@ -77,16 +77,36 @@ if ( empty($_REQUEST['path']) ) {
return; return;
} }
if ( $_REQUEST['fid'] == 'objdetectgif' ) { if ( $_REQUEST['fid'] == 'objdetect' ) {
$path = $Event->Path().'/objdetect.gif'; // if animation file is found, return that, else return image
if ( !file_exists($path) ) { $path_anim = $Event->Path().'/objdetect.gif';
header('HTTP/1.0 404 Not Found'); $path_image = $Event->Path().'/objdetect.jpg';
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"); if ( file_exists($path_anim)) {
} // we found the animation/gif file
$Frame = new ZM\Frame(); $path = $path_anim;
$Frame->Id('objdetect'); ZM\Logger::Debug("Animation file found at $path");
$image_type = 'image/gif'; $image_type = 'image/gif';
} else if ( $_REQUEST['fid'] == 'objdetect' ) { } 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'; $path = $Event->Path().'/objdetect.jpg';
if ( !file_exists($path) ) { if ( !file_exists($path) ) {
header('HTTP/1.0 404 Not Found'); header('HTTP/1.0 404 Not Found');