Changeset 82


Ignore:
Timestamp:
Jun 23, 2012, 11:58:40 PM (13 years ago)
Author:
chronos
Message:
  • Upraveno: Na stránce web kamer velikost změněna na slovní označení místo bodových rozměrů. Nově jsou podporovány obrázky s jiným poměrem než 4:3.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Pages/UWebCamPage.pas

    r81 r82  
    4141  Id: Integer;
    4242  LastFileDate: string;
    43   ImageWidth, ImageHeight: string;
     43  ImageWidth, ImageHeight: Integer;
     44  ImageWidthThumb, ImageHeightThumb: Integer;
    4445begin
    4546  with TWebSession(HandlerData) do begin
     
    5455      if HandlerData.Request.Query.IndexOfName('Id') = -1 then Id := ''
    5556        else Id := IntToStr(StrToInt(HandlerData.Request.Query.Values['Id']));
    56       if (HandlerData.Request.Query.IndexOfName('W') = -1) or
    57         (HandlerData.Request.Query.IndexOfName('H') = -1) then begin
    58         ImageWidth := '640';
    59         ImageHeight := '480';
     57      if (HandlerData.Request.Query.IndexOfName('W') = -1) then begin
     58        ImageWidth := 640;
    6059      end else begin
    61         ImageWidth := IntToStr(StrToInt(HandlerData.Request.Query.Values['W']));
    62         ImageHeight := IntToStr(StrToInt(HandlerData.Request.Query.Values['H']));
     60        ImageWidth := StrToInt(HandlerData.Request.Query.Values['W']);
    6361      end;
    6462
    6563      Text := Text + '<table style="width: 100%"><tr><td style="width: 20%" valign="top">' +
    6664        '<strong>Velikost</strong><br/>' +
    67         '<a href="?W=320&H=240&Id=' + Id + '">320x240</a><br/> ' +
    68         '<a href="?W=640&H=480&Id=' + Id + '">640x480</a><br/> ' +
    69         '<a href="?W=1024&H=768&Id=' + Id + '">1024x768</a><br/> ' +
    70         '<a href="?W=1280&H=1024&Id=' + Id + '">1280x1024</a><br/><br/>';
     65        '<a href="?W=160&Id=' + Id + '">Malá</a><br/> ' +
     66        '<a href="?W=320&Id=' + Id + '">Menší</a><br/> ' +
     67        '<a href="?W=640&Id=' + Id + '">Střední</a><br/> ' +
     68        '<a href="?W=1024&Id=' + Id + '">Větší</a><br/> ' +
     69        '<a href="?W=1280&Id=' + Id + '">Velká</a><br/><br/>';
    7170
    7271      Text := Text + '<strong>Místní kamery</strong><br/>';
    73       Text := Text + '<a href="?W=' + ImageWidth +
    74       '&H=' + ImageHeight +'">Všechny</a><br/>';
     72      Text := Text + '<a href="?W=' + IntToStr(ImageWidth) + '">Všechny</a><br/>';
    7573      try
    7674        DbRows := TDbRows.Create;
    77         Database.Query(DbRows, 'SELECT * FROM Webcam WHERE Enabled=1');
     75        Database.Query(DbRows, 'SELECT * FROM `Webcam` WHERE `Enabled`=1');
    7876        for I := 0 to DbRows.Count - 1 do begin
    79           Text := Text + '<a href="?Id=' + DbRows[I].Values['Id'] + '&W=' + ImageWidth +
    80           '&H=' + ImageHeight +'">' + DbRows[I].Values['Name'] + '</a><br/>';
     77          Text := Text + '<a href="?Id=' + DbRows[I].Values['Id'] + '&W=' + IntToStr(ImageWidth) +
     78          '">' + DbRows[I].Values['Name'] + '</a><br/>';
    8179        end;
    8280      finally
     
    9391        try
    9492          DbRows := TDbRows.Create;
    95           Database.Query(DbRows, 'SELECT * FROM Webcam WHERE Enabled=1');
     93          Database.Query(DbRows, 'SELECT * FROM `Webcam` WHERE `Enabled`=1');
     94          ImageWidthThumb := 160;
    9695          for I := 0 to DbRows.Count - 1 do begin
     96            ImageHeightThumb := Round(ImageWidthThumb * StrToInt(DbRows[I].Values['Height']) / StrToInt(DbRows[I].Values['Width']));
    9797            WebCamImage := 'images/webcam/' + DbRows[I].Values['ImageName'];
    98             Text := Text + '<span align="center">' + //DbRows[I].Values['Name'] + '<br/>' +
    99         '<a href="?Id=' + DbRows[I].Values['Id'] + '&W=' + ImageWidth +
    100           '&H=' + ImageHeight +'">' +
    101         '<img name="theImage" src="' + NavigationLink('/' + WebCamImage) + '" width="160" height="120" alt="' +
    102         DbRows[I].Values['Name'] + '"/></a></span> ';
     98            Text := Text + '<span align="center" valign="middle" style="vertical-align: middle;">' + //DbRows[I].Values['Name'] + '<br/>' +
     99              '<a href="?Id=' + DbRows[I].Values['Id'] + '&W=' + IntToStr(ImageWidth) + '">' +
     100              '<img name="theImage" src="' + NavigationLink('/' + WebCamImage) + '" width="' +
     101            IntToStr(ImageWidthThumb) + '" height="' + IntToStr(ImageHeightThumb) + '" alt="' +
     102            DbRows[I].Values['Name'] + '"/></a></span> ';
    103103          end;
    104104        finally
     
    108108      try
    109109        DbRows := TDbRows.Create;
    110         Database.Query(DbRows, 'SELECT * FROM Webcam WHERE (Id=' +
    111           Id + ') AND (Enabled=1)');
     110        Database.Query(DbRows, 'SELECT * FROM `Webcam` WHERE (`Id`=' +
     111          Id + ') AND (`Enabled`=1)');
    112112        if DbRows.Count > 0 then begin
    113113
     
    115115          RefreshInterval := StrToInt(DbRows[0].Values['ImagePeriod']);
    116116          Id := DbRows[0].Values['Id'];
     117          ImageHeight := Round(ImageWidth * StrToInt(DbRows[0].Values['Height']) / StrToInt(DbRows[0].Values['Width']));
    117118
    118119        if FileExists(WebCamImage) then begin
     
    142143        '<br /><div align="center">' + DbRows[0].Values['Name'] + '<br/>' +
    143144        '<img name="theImageTemp" src="' + NavigationLink('/' + WebCamImage) + '" width="0" height="0" alt="Temp image"/>' +
    144         '<img name="theImage" src="' + NavigationLink('/' + WebCamImage) + '" width="' + ImageWidth + '" height="' + ImageHeight + '" alt="' +
     145        '<img name="theImage" src="' + NavigationLink('/' + WebCamImage) + '" width="' + IntToStr(ImageWidth) +
     146        '" height="' + IntToStr(ImageHeight) + '" alt="' +
    145147        DbRows[0].Values['Name'] + '"/><br/>Aktualizace: <span id="lasttime">' +
    146148          LastFileDate + '</span>, Perioda: ' +
  • trunk/UCore.lfm

    r80 r82  
    1 object MainModule: TMainModule
     1object Core: TCore
    22  OldCreateOrder = False
    33  Height = 278
  • trunk/UCore.lrs

    r80 r82  
    1 { This is an automatically generated lazarus resource file }
    2 
    3 LazarusResources.Add('TMainModule','FORMDATA',[
    4   'TPF0'#11'TMainModule'#10'MainModule'#14'OldCreateOrder'#8#6'Height'#3#22#1#16
    5   +'HorizontalOffset'#3#17#1#14'VerticalOffset'#3#208#0#5'Width'#3#175#1#0#7'TW'
    6   +'ebApp'#7'WebApp1'#13'OnPageProduce'#7#18'WebApp1PageProduce'#10'ServerType'
    7   +#7#5'stTCP'#4'left'#3#160#0#3'top'#2'X'#0#0#0
     1LazarusResources.Add('TCore','FORMDATA',[
     2  'TPF0'#5'TCore'#4'Core'#14'OldCreateOrder'#8#6'Height'#3#22#1#16'HorizontalOf'
     3  +'fset'#3#17#1#14'VerticalOffset'#3#208#0#5'Width'#3#175#1#0#7'TWebApp'#7'Web'
     4  +'App1'#13'OnPageProduce'#7#18'WebApp1PageProduce'#10'ServerType'#7#5'stTCP'#4
     5  +'left'#3#160#0#3'top'#2'X'#0#0#0
    86]);
  • trunk/ZdechovNET.lpi

    r81 r82  
    191191        <IsPartOfProject Value="True"/>
    192192        <ComponentName Value="ProjectsPage"/>
     193        <HasResources Value="True"/>
    193194        <ResourceBaseClass Value="DataModule"/>
    194195        <UnitName Value="UProjectsPage"/>
     
    207208        <Filename Value="UCore.pas"/>
    208209        <IsPartOfProject Value="True"/>
    209         <HasResources Value="True"/>
     210        <ComponentName Value="Core"/>
     211        <HasResources Value="True"/>
     212        <ResourceBaseClass Value="DataModule"/>
    210213        <UnitName Value="UCore"/>
    211214      </Unit23>
     
    218221    </Target>
    219222    <SearchPaths>
    220       <OtherUnitFiles Value="/usr/lib/mysql;/usr/lib64/mysql;Application;WebServer;Network;Pages;Modules/User;Common"/>
     223      <OtherUnitFiles Value="/usr/lib/mysql/;/usr/lib64/mysql/;Application;WebServer;Network;Pages;Modules/User;Common"/>
    221224      <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
    222225    </SearchPaths>
Note: See TracChangeset for help on using the changeset viewer.