Changeset 152 for www/webcam


Ignore:
Timestamp:
Feb 16, 2009, 2:09:57 PM (16 years ago)
Author:
george
Message:
  • Upraveno: Další soubory přepracované do nového systému zobrazování.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • www/webcam/index.php

    r41 r152  
    11<?php
    22
    3 include('../style.php');
    4 ShowHeader('Kamera', 'Webová kamera');
     3include('../global.php');
    54
    6 $ReloadPeriod = $Config['Web']['WebcamRefresh'] * 1000; // ms
     5class WebcamPage extends Page
     6{
     7  var $FullTitle = 'Webová kamera';
     8  var $ShortTitle = 'Kamera';
     9 
     10  function Show()
     11  {
     12    global $Config;
    713
    8 echo('
    9 <script language="JavaScript">
    10 // Set the BaseURL to the url of your camera
    11 // Note: Since this file is located inside the unit itself, no base url is specified here
    12 // Example:  var BaseURL = "http://172.21.1.122/";
    13 var BaseURL = "http://centrala.zdechov.net/";
     14    if(file_exists($this->System->Modules['Webcam']->ImageFileName))
     15    {
     16      $Output = '<script language="JavaScript">
     17      var ImageURL = "'.$Config['Web']['RootFolder'].'/webcam/'.$this->System->Modules['Webcam']->ImageFileName.'";
    1418
    15 // This is the filepath to the image generating file inside the camera itself
    16 var File = "webcam/webcam.jpg";
    17    
    18 // Force an immediate image load
    19 var theTimer = setTimeout("reloadImage()", 1);
    20        
    21 function reloadImage()
    22 {
    23   theDate = new Date();
    24   var url = BaseURL;
    25   url += File;
    26   url += "?dummy=";
    27   url += theDate.getTime().toString(10);
    28   // The above dummy cgi-parameter enforce a bypass of the browser image cache.
    29   // Here we actually load the image
    30   document.theImage.src = url;
    31                  
    32   // Reload the image every 10 seconds (10000 ms)
    33   theTimer = setTimeout("reloadImage()", '.$ReloadPeriod.');   
     19      // Force an immediate image load
     20      var theTimer = setTimeout("reloadImage()", 1);
     21
     22      function reloadImage()
     23      {
     24        theDate = new Date();
     25        var url = ImageURL;
     26        url += "?dummy=";
     27        url += theDate.getTime().toString(10);
     28        // The above dummy cgi-parameter enforce a bypass of the browser image cache.
     29        // Here we actually load the image
     30        document.theImage.src = url;
     31
     32        // Reload the image every defined period
     33        theTimer = setTimeout("reloadImage()", '.($Config['Web']['WebcamRefresh'] * 1000).');
     34      }
     35      </script>';
     36
     37      $Output .= '<br /><div align="center"><img name="theImage" src="" idth="640" height="480" alt="Webcam image"><br>Poslední aktualizace: '.date('j.n.Y G:i', filemtime($this->System->Modules['Webcam']->ImageFileName)).'<br>Obnovování po '.$Config['Web']['WebcamRefresh'].' sekundách</div><br />';
     38    } else $Output = '<br />Obrázek nenalezen.<br /><br />';
     39
     40    $Output .= '<strong>Kamery v okolí:</strong><br />'.
     41      '<a href="http://www.mestovsetin.cz/vismo/dokumenty2.asp?id_org=18676&id=480245">Webové kamery ve Vsetíně</a><br />';
     42
     43    return($Output);
     44  }
    3445}
    35                                
    36 </script>');
    3746
    38 echo('<br><div align="center"><img name="theImage" src="" idth="640" height="480" alt="Webcam image"><br>Poslední aktualizace: '.date('j.n.Y G:i', filemtime('webcam.jpg')).'<br>Obnovování po '.$Config['Web']['WebcamRefresh'].' sekundách</div><br>');
     47$System->AddModule(new WebcamPage());
     48$System->Modules['WebcamPage']->GetOutput();
    3949
    40 echo('<strong>Kamery v okolí:</strong><br><a href="http://www.inext.cz/webkamera_updated.htm">Ulice nádražní a Smetanova Vsetín</a><br>');
    41 ShowFooter();
    4250?>
Note: See TracChangeset for help on using the changeset viewer.