diff --git a/web/zm_funcs.php b/web/zm_funcs.php index e515c87aa..80561b825 100644 --- a/web/zm_funcs.php +++ b/web/zm_funcs.php @@ -1005,16 +1005,16 @@ function getImageSrc( $event, $frame, $scale, $capture_only=false, $overwrite=fa $has_anal_image = $alarm_frame && file_exists( $anal_path ) && filesize( $anal_path ); $is_anal_image = $has_anal_image && !$capture_only; - if ( $scale >= 100 || !file_exists( ZM_PATH_NETPBM."/jpegtopnm" ) ) + if ( $scale >= SCALE_BASE || !file_exists( ZM_PATH_NETPBM."/jpegtopnm" ) ) { $image_path = $thumb_path = $is_anal_image?$anal_path:$capt_path; } else { if ( version_compare( phpversion(), "4.3.10", ">=") ) - $fraction = sprintf( "%.3F", $scale/100 ); + $fraction = sprintf( "%.3F", $scale/SCALE_BASE ); else - $fraction = sprintf( "%.3f", $scale/100 ); + $fraction = sprintf( "%.3f", $scale/SCALE_BASE ); $scale = (int)round( $scale ); $thumb_capt_path = preg_replace( "/\.jpg$/", "-$scale.jpg", $thumb_capt_path ); @@ -1112,7 +1112,7 @@ function createImage( $monitor, $scale ) } chdir( ZM_DIR_IMAGES ); $command = getZmuCommand( " -m $monitor -i" ); - if ( !empty($scale) && $scale < 100 ) + if ( !empty($scale) && $scale < SCALE_BASE ) $command .= " -S $scale"; $status = exec( escapeshellcmd( $command ) ); chdir( '..' ); diff --git a/web/zm_xhtml_view_event.php b/web/zm_xhtml_view_event.php index fab3f3cc5..749c68648 100644 --- a/web/zm_xhtml_view_event.php +++ b/web/zm_xhtml_view_event.php @@ -223,9 +223,9 @@ $scale = getDeviceScale( $event['Width'], $event['Height'], $frames_per_line ); $count = 0; if ( version_compare( phpversion(), "4.3.10", ">=") ) - $fraction = sprintf( "%.2F", $scale/100 ); + $fraction = sprintf( "%.2F", $scale/SCALE_BASE ); else - $fraction = sprintf( "%.2f", $scale/100 ); + $fraction = sprintf( "%.2f", $scale/SCALE_BASE ); $event_path = getEventPath( $event ); for ( $frame_id = $lo_frame_id; $frame_id <= $hi_frame_id; $frame_id++, $count++ ) { @@ -239,7 +239,7 @@ for ( $frame_id = $lo_frame_id; $frame_id <= $hi_frame_id; $frame_id++, $count++ $image_path = sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg", $event_path, $frame_id ); $capt_image = $image_path; - if ( $scale == 1 || !file_exists( ZM_PATH_NETPBM."/jpegtopnm" ) ) + if ( $scale == SCALE_BASE || !file_exists( ZM_PATH_NETPBM."/jpegtopnm" ) ) { $anal_image = preg_replace( "/capture/", "analyse", $image_path ); @@ -263,7 +263,6 @@ for ( $frame_id = $lo_frame_id; $frame_id <= $hi_frame_id; $frame_id++, $count++ $command = ZM_PATH_NETPBM."/jpegtopnm -dct fast $anal_image | ".ZM_PATH_NETPBM."/pnmscalefixed $fraction | ".ZM_PATH_NETPBM."/ppmtojpeg --dct=fast > $thumb_image"; else $command = ZM_PATH_NETPBM."/jpegtopnm -dct fast $capt_image | ".ZM_PATH_NETPBM."/pnmscalefixed $fraction | ".ZM_PATH_NETPBM."/ppmtojpeg --dct=fast > $thumb_image"; - #exec( escapeshellcmd( $command ) ); exec( $command ); } } diff --git a/web/zm_xhtml_view_eventdetails.php b/web/zm_xhtml_view_eventdetails.php index 05b7a0fda..1173ce21f 100644 --- a/web/zm_xhtml_view_eventdetails.php +++ b/web/zm_xhtml_view_eventdetails.php @@ -51,7 +51,7 @@ function getThumbnail( $event, $fid, $scale ) } $alarm_frame = $frame['Type']=='Alarm'; - if ( $scale == 100 || !file_exists( ZM_PATH_NETPBM."/jpegtopnm" ) ) + if ( $scale == SCALE_BASE || !file_exists( ZM_PATH_NETPBM."/jpegtopnm" ) ) { $thumb_image = $image_path; } @@ -62,9 +62,9 @@ function getThumbnail( $event, $fid, $scale ) if ( !file_exists($thumb_image) || !filesize( $thumb_image ) ) { if ( version_compare( phpversion(), "4.3.10", ">=") ) - $fraction = sprintf( "%.2F", $scale/100 ); + $fraction = sprintf( "%.2F", $scale/SCALE_BASE ); else - $fraction = sprintf( "%.2f", $scale/100 ); + $fraction = sprintf( "%.2f", $scale/SCALE_BASE ); if ( file_exists( $image_path ) ) { $command = ZM_PATH_NETPBM."/jpegtopnm -dct fast $image_path | ".ZM_PATH_NETPBM."/pnmscalefixed $fraction | ".ZM_PATH_NETPBM."/ppmtojpeg --dct=fast > $thumb_image";