Changeset 82 for trunk/Pages
- Timestamp:
- Jun 23, 2012, 11:58:40 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Pages/UWebCamPage.pas
r81 r82 41 41 Id: Integer; 42 42 LastFileDate: string; 43 ImageWidth, ImageHeight: string; 43 ImageWidth, ImageHeight: Integer; 44 ImageWidthThumb, ImageHeightThumb: Integer; 44 45 begin 45 46 with TWebSession(HandlerData) do begin … … 54 55 if HandlerData.Request.Query.IndexOfName('Id') = -1 then Id := '' 55 56 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; 60 59 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']); 63 61 end; 64 62 65 63 Text := Text + '<table style="width: 100%"><tr><td style="width: 20%" valign="top">' + 66 64 '<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/>'; 71 70 72 71 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/>'; 75 73 try 76 74 DbRows := TDbRows.Create; 77 Database.Query(DbRows, 'SELECT * FROM Webcam WHERE Enabled=1');75 Database.Query(DbRows, 'SELECT * FROM `Webcam` WHERE `Enabled`=1'); 78 76 for I := 0 to DbRows.Count - 1 do begin 79 Text := Text + '<a href="?Id=' + DbRows[I].Values['Id'] + '&W=' + I mageWidth+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/>'; 81 79 end; 82 80 finally … … 93 91 try 94 92 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; 96 95 for I := 0 to DbRows.Count - 1 do begin 96 ImageHeightThumb := Round(ImageWidthThumb * StrToInt(DbRows[I].Values['Height']) / StrToInt(DbRows[I].Values['Width'])); 97 97 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> '; 103 103 end; 104 104 finally … … 108 108 try 109 109 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)'); 112 112 if DbRows.Count > 0 then begin 113 113 … … 115 115 RefreshInterval := StrToInt(DbRows[0].Values['ImagePeriod']); 116 116 Id := DbRows[0].Values['Id']; 117 ImageHeight := Round(ImageWidth * StrToInt(DbRows[0].Values['Height']) / StrToInt(DbRows[0].Values['Width'])); 117 118 118 119 if FileExists(WebCamImage) then begin … … 142 143 '<br /><div align="center">' + DbRows[0].Values['Name'] + '<br/>' + 143 144 '<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="' + 145 147 DbRows[0].Values['Name'] + '"/><br/>Aktualizace: <span id="lasttime">' + 146 148 LastFileDate + '</span>, Perioda: ' +
Note:
See TracChangeset
for help on using the changeset viewer.