Page 1 of 1

[solved sortof] wrong path in zmEventImagesMaster.html

Posted: Fri Apr 18, 2014 7:01 am
by hesral
When I export an event to zip or tar, and tries to play back by opening the zmEventImagesMaster.html file, the page doesn't load any images. I can play the event by going down the path to the images and opening zmEventImages.html.

I found that the path in zmEventImagesMaster.html points to a path like "monitornumber/eventID". The actual path to zmEventImages.html is "monitornumber/Year/Month/Day/Hour/Minute/Second/"(time of first image in event). By changing the path in the zmEventImagesMaster.html file, to the actual path to zmEventImages.html, things start working as they should.

I use firefox on ubuntu 13.10 64b for playback. The servers are all zoneminder v1.27 on ubuntu server 12.04 64b using the iconnor ppa.

Re: wrong path in zmEventImagesMaster.html

Posted: Mon Apr 21, 2014 9:29 am
by hesral
I fixed it by making some changes to /usr/share/zoneminder/skins/classic/includes/export_functions.php

changed function exportEventImagesMaster from line 666 to 690. It is a bit hacky, but it works for me. I bet it is pretty much the same for the flat skin, but I just use the classic. It would be a lot more efficient to just make one for-loop for the database calls, but I didn't want to mess around too much in there.

It would be nice if someone from the head office would look at it, and tell me if I broke something. It was my first dip into the code, and I mostly code in python.

changed this:

Code: Select all

	<?php foreach($eids as $eid) 
	{
	?>
		<div><a href="javascript:switchevent('<?php echo   $eventMonitorId[$eid].'/' . $eid; ?>/zmEventImages.html');"><?=$eid?></a></div>
		<?php
	} 
	?>
	</div>
	<?php
	
		foreach ($monitors as $monitor)
		{
			echo "<div class='tab_content' id='tab$monitor'>";
			echo "<h2>Monitor: " . $monitorNames[$monitor] . " </h2>";
			foreach ($eids as $eid)
			{
				if ($eventMonitorId[$eid] == $monitor)
				{
				?>	
				<div><a href="javascript:switchevent('<?php echo   $eventMonitorId[$eid].'/' . $eid; ?>/zmEventImages.html');"><?=$eid?></a></div>	
				<?php
				}
			}
			echo'</div>';
		}
into this:

Code: Select all

	<?php foreach($eids as $eid) 
	{
      # ----- start change by hesral -----
      $sql = "select E.Id,E.MonitorId,M.Name As MonitorName,M.Width,M.Height,E.Name,E.Cause,E.Notes,E.StartTime,E.Length,E.Frames,E.AlarmFrames,E.TotScore,E.AvgScore,E.MaxScore,E.Archived from Monitors as M inner join Events as E on (M.Id = E.MonitorId) where E.Id = '".dbEscape($eid)."'";
      $event = dbFetchOne( $sql );
      $eventPath =  mygetEventPath( $event );
      $event_path_array = explode('/', $eventPath);
      unset($event_path_array[0]);
      $eventPath = implode('/',$event_path_array);
	?>
		<div><a href="javascript:switchevent('<?php echo   $eventPath; ?>/zmEventImages.html');"><?=$eid?></a></div>
		<?php
      # ----- stop change by hesral -----
	} 
	?>
	</div>
	<?php
	
		foreach ($monitors as $monitor)
		{
			echo "<div class='tab_content' id='tab$monitor'>";
			echo "<h2>Monitor: " . $monitorNames[$monitor] . " </h2>";
			foreach ($eids as $eid)
			{
				if ($eventMonitorId[$eid] == $monitor)
				{
               # ----- start change by hesral -----
               $sql = "select E.Id,E.MonitorId,M.Name As MonitorName,M.Width,M.Height,E.Name,E.Cause,E.Notes,E.StartTime,E.Length,E.Frames,E.AlarmFrames,E.TotScore,E.AvgScore,E.MaxScore,E.Archived from Monitors as M inner join Events as E on (M.Id = E.MonitorId) where E.Id = '".dbEscape($eid)."'";
               $event = dbFetchOne( $sql );
               $eventPath =  mygetEventPath( $event );
               $event_path_array = explode('/', $eventPath);
               unset($event_path_array[0]);
               $eventPath = implode('/',$event_path_array);
				?>	
				<div><a href="javascript:switchevent('<?php echo   $eventPath; ?>/zmEventImages.html');"><?=$eid?></a></div>	
				<?php
               # ----- stop change by hesral -----
				}
			}
			echo'</div>';
		}