From 921c4c5bbdd747035f433ad25c79e317c8ecb5f0 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Sat, 14 Mar 2020 15:00:33 -0400 Subject: [PATCH] don't return mp4 if objdetect is used --- web/views/image.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/web/views/image.php b/web/views/image.php index 653a5e256..ff26682c7 100644 --- a/web/views/image.php +++ b/web/views/image.php @@ -79,15 +79,12 @@ if ( empty($_REQUEST['path']) ) { if ( $_REQUEST['fid'] == 'objdetect' ) { // if animation file is found, return that, else return image - $path_anim_mp4 = $Event->Path().'/objdetect.mp4'; + // we are only looking for GIF or jpg here, not mp4 + // as most often, browsers asking for this link will be expecting + // media types that can be rendered as $path_anim_gif = $Event->Path().'/objdetect.gif'; $path_image = $Event->Path().'/objdetect.jpg'; - if ( file_exists($path_anim_mp4)) { - // we found the animation mp4 file - $path = $path_anim_mp4; - ZM\Logger::Debug("Animation file found at $path"); - $media_type = 'video/mp4'; - } else if (file_exists($path_anim_gif)) { + if (file_exists($path_anim_gif)) { // we found the animation gif file $media_type = 'image/gif'; ZM\Logger::Debug("Animation file found at $path"); @@ -326,7 +323,7 @@ if ( !empty($_REQUEST['height']) ) { if ( $errorText ) { ZM\Error($errorText); } else { - header("Content-type: $image_type"); + header("Content-type: $media_type"); if ( ( $scale==0 || $scale==100 ) && ($width==0) && ($height==0) ) { # This is so that Save Image As give a useful filename if ( $Event ) {