Skip to content

Commit

Permalink
Little Things
Browse files Browse the repository at this point in the history
Just some little optimizations and tweaks. Hardly worth mentioning.
 - HTTPS link for battlelog player stats link, instead of HTTP
 - buffering of players-by-date data to fix the first date sometimes showing max on the graph, even though it is less than subsequent dates
 - stop caching server banner images if resizing wasn't requested
  • Loading branch information
tyger07 committed Apr 5, 2021
1 parent 1cd5898 commit 57fd46c
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions common/server-banner/image-banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,20 +175,20 @@
}
// initialize variables
$numrows = count($hour);
$increment = 0;
$top_offset = 23;
$height = 60;
$width = 110;
$y_max_display = round($y_max, 0);
$y_division = $height / $y_max;
$x_division = $width / $numrows;
$middle = round(($y_max / 2), 0);
$x_finish = 440;
$last_average = 0;
$loop_count = 0;
// loop through query results
foreach($hour as $this_hour)
{
$this_average = $average[$loop_count];
$y_max_display = round($y_max, 0);
$y_division = $height / $y_max;
$point_average = $height - ($this_average * $y_division) + $top_offset;
$x_start = $x_finish;
$x_finish += $x_division;
Expand All @@ -202,9 +202,7 @@
}
$last_average = $point_average;
$loop_count++;
$increment++;
}
$middle = round(($y_max / 2), 0);
imageline($base, 440, $top_offset, 440, $height + $top_offset, $faded);
if(strlen((string)$y_max_display) > 1)
{
Expand All @@ -228,21 +226,21 @@
else
{
// initialize variables
$increment = 0;
$average = 0;
$y_max = 2;
$top_offset = 23;
$height = 60;
$width = 110;
$y_max_display = round($y_max, 0);
$y_division = $height / $y_max;
$x_division = $width / 24;
$middle = round(($y_max / 2), 0);
$x_finish = 440;
$last_average = 0;
$loop_count = 0;
// add 24 hours of zeroes
while($increment < 24)
while($loop_count < 24)
{
$average = 0;
$y_max = 2;
$y_max_display = round($y_max, 0);
$y_division = $height / $y_max;
$point_average = $height - ($average * $y_division) + $top_offset;
$x_start = $x_finish;
$x_finish += $x_division;
Expand All @@ -256,9 +254,7 @@
}
$last_average = $point_average;
$loop_count++;
$increment++;
}
$middle = round(($y_max / 2), 0);
imageline($base, 440, $top_offset, 440, $height + $top_offset, $faded);
imagestring($base, 1, 430, $height - ($middle * $y_division) + $top_offset - 4, $middle, $light);
imagestring($base, 1, 430, $height + $top_offset - 4, "0", $light);
Expand Down

0 comments on commit 57fd46c

Please sign in to comment.