Page 1 of 1

Zone drawing outside camera resolution

Posted: Thu Jun 09, 2011 10:34 am
by ovkolsi
Noticed following with both zoneminder 1.24.3 (from Fedora 15 package) and 1.24.4 SVN version:

I have Axis camera with 640x480 resolution. When drawing zones, one can easily put a point to invalid position, for example to X coordinate 642 when drawing very closely to the border of the image. This kind of value can further be saved.

Then later when "zma" process is restarted, it starts to crash immediately with signal 134. Drawing part of this problem happens within Fedora 15 with both Firefox 4 and Chrome 12. There's a room for improvements:

- if possible, do not let user to draw "outside" the correct region
- if/when data points are manually entered, do some validation
- latest do some validation when values are saved to database
- improve "zma" process so that it doesn't crash with this kind of zone definition

Re: Zone drawing outside camera resolution

Posted: Thu Jun 09, 2011 11:07 am
by mastertheknife
Hi,

This is a known issue.
I think zma shouldn't clamp the zone coordinates, but instead, the bad zone coordinates shouldn't be stored on the database at the first place!
There is some javascript validation for the zone coordinates, but it doesn't appear to be working. So if Phil or anyone else will try fixing it, it will be awesome :D

mastertheknife.

Re: Zone drawing outside camera resolution

Posted: Tue Jun 14, 2011 7:41 pm
by Normando
A dirty fix:

Code: Select all

--- ./web/skins/classic/views/zone.php.orig	2011-02-25 12:55:49.000000000 -0300
+++ ./web/skins/classic/views/zone.php	2011-02-26 21:17:11.000000000 -0300
@@ -212,7 +212,7 @@
         </div>
         <div id="definitionPanel">
           <div id="imagePanel">
-            <div id="imageFrame" style="width: <?= reScale( $monitor['Width'], $scale ) ?>px; height: <?= reScale( $monitor['Height'], $scale ) ?>px;">
+            <div id="imageFrame" style="width: <?= reScale( $monitor['Width'] - 3, $scale ) ?>px; height: <?= reScale( $monitor['Height'] - 3, $scale ) ?>px;">
               <img name="zoneImage" id="zoneImage" src="<?= $zoneImage ?>" width="<?= reScale( $monitor['Width'], $scale ) ?>" height="<?= reScale( $monitor['Height'], $scale ) ?>" alt="Zone Image"/>
             </div>
           </div>