Changeset 82 for trunk/Pages


Ignore:
Timestamp:
Jun 23, 2012, 11:58:40 PM (12 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.
File:
1 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: ' +
Note: See TracChangeset for help on using the changeset viewer.