Ignore:
Timestamp:
Dec 16, 2012, 10:46:34 PM (12 years ago)
Author:
chronos
Message:
  • Přidáno: Třída pro manipulaci s obrázky.
  • Přidáno: Generování obrázku z měřených dat meteostanice.
Location:
trunk/Modules/Meteostation
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Meteostation/Download.php

    r467 r468  
    44
    55$MeteoStation = new MeteoStation($System->Database, $System);
    6 $MeteoStation->DownloadAll();
     6while(true)
     7{
     8  $MeteoStation->DownloadAll();
     9  sleep(60);
     10}
    711
    812?>
  • trunk/Modules/Meteostation/Meteostation.php

    r467 r468  
    11<?php
     2
     3include_once('../../Common/Image.php');
    24
    35class PageMeteo extends Page
     
    1113class MeteoStation extends AppModule
    1214{
    13  
     15  var $Data;
     16 
    1417  function __construct($Database, $System)
    1518  {
     
    4851      'RelHumidity' => $Data['RelHumidity'], 'AbsHumidity' => $Data['AbsHumidity'],
    4952      'DewPoint' => $Data['DewPoint']));
     53    $this->Data = $Data;
    5054  }
    5155 
     
    5660    {
    5761      $this->DownloadData($DbRow['Id'], $DbRow['URL']);
     62      $this->CreateImage('cache/'.$DbRow['Id'].'.png');
    5863    }
     64  }
     65 
     66  function CreateImage($FileName)
     67  {
     68    $Image = new Image();
     69    $Image->SetSize(150, 150);
     70    $Image->Brush->Color = COLOR_WHITE;
     71    $Image->FillRect(0, 0, $Image->GetWidth(), $Image->GetHeight());
     72    //$Image->Font->Color = COLOR_RED;
     73    //$Image->Line(10, 10, 100, 100);
     74    $Image->TextOut(10, 10, 'Meteo Koliba Zděchov');
     75    $Image->TextOut(10, 30, 'Teplote: '.$this->Data['Temperature'].' °C');
     76    $Image->SaveToFile($FileName);
    5977  }
    6078 
Note: See TracChangeset for help on using the changeset viewer.