From 704e1c22efe6056b0fc2f59b2766f47e1c8d71cc Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Mon, 3 Apr 2023 22:22:48 +0200 Subject: Updated 19 files and added 12 files (automated) --- includes/refresh/logo.inc | 322 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 322 insertions(+) create mode 100644 includes/refresh/logo.inc (limited to 'includes/refresh/logo.inc') diff --git a/includes/refresh/logo.inc b/includes/refresh/logo.inc new file mode 100644 index 0000000..3e88140 --- /dev/null +++ b/includes/refresh/logo.inc @@ -0,0 +1,322 @@ += $columns) { + $packs[] = $currentPack; + $currentPack = []; + } + + $currentPack[] = $member["color"]; +} + +if (count($currentPack) > 0) $packs[] = $currentPack; + +$newPacks = []; +foreach ($packs as $pack) { + usort($pack, function ($a, $b) { + $vra = hexdec(substr($a, 0, 2)); + $vga = hexdec(substr($a, 2, 2)); + $vba = hexdec(substr($a, 4, 2)); + + $hsla = rgbToHsl($vra, $vga, $vba); + $ra = $hsla[2] * $hsla[1]; + + $vrb = hexdec(substr($b, 0, 2)); + $vgb = hexdec(substr($b, 2, 2)); + $vbb = hexdec(substr($b, 4, 2)); + + $hslb = rgbToHsl($vrb, $vgb, $vbb); + $rb = $hslb[2] * $hslb[1]; + + return $rb < $ra; + }); + + while (count($pack) < $columns) $pack[] = "ffffff"; + + $newPacks[] = $pack; +} + +$img = imagecreatetruecolor($columns, $columns); +$factor = 64; + +for ($y = 0; $y < $columns; ++$y) { + for ($x = 0; $x < $columns; ++$x) { + if (isset($newPacks[$y][$x])) { + imagesetpixel($img, $x, $y, imagecolorallocate($img, hexdec(substr($newPacks[$y][$x], 0, 2)), hexdec(substr($newPacks[$y][$x], 2, 2)), hexdec(substr($newPacks[$y][$x], 4, 2)))); + } else { + imagesetpixel($img, $x, $y, imagecolorallocate($img, 255, 255, 255)); + } + } +} + +$img2 = imagecreatetruecolor($columns * $factor, $columns * $factor); +imagecopyresampled($img2, $img, 0, 0, 0, 0, $columns * $factor, $columns * $factor, $columns, $columns); + +imagepng($img2, "/tmp/image.png"); +$img3 = imageCreateCorners("/tmp/image.png", $columns * 10); +unlink("/tmp/image.png"); + +imagepng($img3, $_SERVER['DOCUMENT_ROOT'] . "/assets/logo/newlogo.png"); +imagepng($img3, "/tmp/ponieslogo1.png"); + +for ($x = 1; $x <= 120; $x++) { + imagefilter($img2, IMG_FILTER_GAUSSIAN_BLUR); +} + +imagefilter($img2, IMG_FILTER_BRIGHTNESS, -100); + +imagepng($img2, "/tmp/image.png"); +$img3 = imageCreateCorners("/tmp/image.png", $columns * 10); +unlink("/tmp/image.png"); + +imagepng($img3, $_SERVER['DOCUMENT_ROOT'] . "/assets/logo/newlogo-template.png"); +imagepng($img3, "/tmp/ponieslogo2.png"); + +// -------------------------- + +/*$columns = ceil(sqrt(count(array_filter(scoreOrderGlobal(), function ($i) { + return $i["_system"] === "gdapd"; +})))); +echo(" Using " . $columns . " columns\n"); + +$members = array_values(array_filter(scoreOrderGlobal(), function ($i) { + return $i["_system"] === "gdapd"; +})); + +usort($members, function ($a, $b) { + $vr = hexdec(substr($a["color"], 0, 2)); + $vg = hexdec(substr($a["color"], 2, 2)); + $vb = hexdec(substr($a["color"], 4, 2)); + + $hsl = rgbToHsl($vr, $vg, $vb); + if ($hsl[0] == 0) $hsl[0] = 360; + $ra = $hsl[0]; + + $vr = hexdec(substr($b["color"], 0, 2)); + $vg = hexdec(substr($b["color"], 2, 2)); + $vb = hexdec(substr($b["color"], 4, 2)); + + $hsl = rgbToHsl($vr, $vg, $vb); + if ($hsl[0] == 0) $hsl[0] = 360; + $rb = $hsl[0]; + + return $ra - $rb; +}); + +echo(" " . count($members) . " members\n"); + +$packs = []; +$currentPack = []; + +foreach ($members as $member) { + if (count($currentPack) >= $columns) { + $packs[] = $currentPack; + $currentPack = []; + } + + $currentPack[] = $member["color"]; +} + +if (count($currentPack) > 0) $packs[] = $currentPack; + +$newPacks = []; +foreach ($packs as $pack) { + usort($pack, function ($a, $b) { + $vra = hexdec(substr($a, 0, 2)); + $vga = hexdec(substr($a, 2, 2)); + $vba = hexdec(substr($a, 4, 2)); + + $hsla = rgbToHsl($vra, $vga, $vba); + $ra = $hsla[2] * $hsla[1]; + + $vrb = hexdec(substr($b, 0, 2)); + $vgb = hexdec(substr($b, 2, 2)); + $vbb = hexdec(substr($b, 4, 2)); + + $hslb = rgbToHsl($vrb, $vgb, $vbb); + $rb = $hslb[2] * $hslb[1]; + + return $rb < $ra; + }); + + while (count($pack) < $columns) $pack[] = "ffffff"; + + $newPacks[] = $pack; +} + +$img = imagecreatetruecolor($columns, $columns); +$factor = 64; + +for ($y = 0; $y < $columns; ++$y) { + for ($x = 0; $x < $columns; ++$x) { + if (isset($newPacks[$y][$x])) { + imagesetpixel($img, $x, $y, imagecolorallocate($img, hexdec(substr($newPacks[$y][$x], 0, 2)), hexdec(substr($newPacks[$y][$x], 2, 2)), hexdec(substr($newPacks[$y][$x], 4, 2)))); + } else { + imagesetpixel($img, $x, $y, imagecolorallocate($img, 255, 255, 255)); + } + } +} + +$img2 = imagecreatetruecolor($columns * $factor, $columns * $factor); +imagecopyresampled($img2, $img, 0, 0, 0, 0, $columns * $factor, $columns * $factor, $columns, $columns); + +imagepng($img2, "/tmp/image.png"); +$img3 = imageCreateCorners("/tmp/image.png", $columns * 10); +unlink("/tmp/image.png"); + +imagepng($img3, $_SERVER['DOCUMENT_ROOT'] . "/assets/logo/newlogo2.png"); +imagepng($img3, "/tmp/ponieslogo1a.png"); + +for ($x = 1; $x <= 120; $x++) { + imagefilter($img2, IMG_FILTER_GAUSSIAN_BLUR); +} + +imagefilter($img2, IMG_FILTER_BRIGHTNESS, -100); + +imagepng($img2, "/tmp/image.png"); +$img3 = imageCreateCorners("/tmp/image.png", $columns * 10); +unlink("/tmp/image.png"); + +imagepng($img3, $_SERVER['DOCUMENT_ROOT'] . "/assets/logo/newlogo2-template.png"); +imagepng($img3, "/tmp/ponieslogo2a.png");*/ + +// -------------------------- + +$isLoggedIn = true; +$isLowerLoggedIn = false; + +$columns = ceil(sqrt(count(array_filter(scoreOrderGlobal())))); +echo(" Using " . $columns . " columns\n"); + +$members = array_values(array_filter(scoreOrderGlobal())); + +usort($members, function ($a, $b) { + $vr = hexdec(substr($a["color"], 0, 2)); + $vg = hexdec(substr($a["color"], 2, 2)); + $vb = hexdec(substr($a["color"], 4, 2)); + + $hsl = rgbToHsl($vr, $vg, $vb); + if ($hsl[0] == 0) $hsl[0] = 360; + $ra = $hsl[0]; + + $vr = hexdec(substr($b["color"], 0, 2)); + $vg = hexdec(substr($b["color"], 2, 2)); + $vb = hexdec(substr($b["color"], 4, 2)); + + $hsl = rgbToHsl($vr, $vg, $vb); + if ($hsl[0] == 0) $hsl[0] = 360; + $rb = $hsl[0]; + + return $ra - $rb; +}); + +echo(" " . count($members) . " members\n"); + +$packs = []; +$currentPack = []; + +foreach ($members as $member) { + if (count($currentPack) >= $columns) { + $packs[] = $currentPack; + $currentPack = []; + } + + $currentPack[] = $member["color"]; +} + +if (count($currentPack) > 0) $packs[] = $currentPack; + +$newPacks = []; +foreach ($packs as $pack) { + usort($pack, function ($a, $b) { + $vra = hexdec(substr($a, 0, 2)); + $vga = hexdec(substr($a, 2, 2)); + $vba = hexdec(substr($a, 4, 2)); + + $hsla = rgbToHsl($vra, $vga, $vba); + $ra = $hsla[2] * $hsla[1]; + + $vrb = hexdec(substr($b, 0, 2)); + $vgb = hexdec(substr($b, 2, 2)); + $vbb = hexdec(substr($b, 4, 2)); + + $hslb = rgbToHsl($vrb, $vgb, $vbb); + $rb = $hslb[2] * $hslb[1]; + + return $rb < $ra; + }); + + while (count($pack) < $columns) $pack[] = "ffffff"; + + $newPacks[] = $pack; +} + +$img = imagecreatetruecolor($columns, $columns); +$factor = 64; + +for ($y = 0; $y < $columns; ++$y) { + for ($x = 0; $x < $columns; ++$x) { + if (isset($newPacks[$y][$x])) { + imagesetpixel($img, $x, $y, imagecolorallocate($img, hexdec(substr($newPacks[$y][$x], 0, 2)), hexdec(substr($newPacks[$y][$x], 2, 2)), hexdec(substr($newPacks[$y][$x], 4, 2)))); + } else { + imagesetpixel($img, $x, $y, imagecolorallocate($img, 255, 255, 255)); + } + } +} + +$img2 = imagecreatetruecolor($columns * $factor, $columns * $factor); +imagecopyresampled($img2, $img, 0, 0, 0, 0, $columns * $factor, $columns * $factor, $columns, $columns); + +imagepng($img2, "/tmp/image.png"); +$img3 = imageCreateCorners("/tmp/image.png", $columns * 10); +unlink("/tmp/image.png"); + +imagepng($img3, $_SERVER['DOCUMENT_ROOT'] . "/assets/logo/newlogo3.png"); +imagepng($img3, "/tmp/ponieslogo1b.png"); + +for ($x = 1; $x <= 120; $x++) { + imagefilter($img2, IMG_FILTER_GAUSSIAN_BLUR); +} + +imagefilter($img2, IMG_FILTER_BRIGHTNESS, -100); + +imagepng($img2, "/tmp/image.png"); +$img3 = imageCreateCorners("/tmp/image.png", $columns * 10); +unlink("/tmp/image.png"); + +imagepng($img3, $_SERVER['DOCUMENT_ROOT'] . "/assets/logo/newlogo3-template.png"); +imagepng($img3, "/tmp/ponieslogo2b.png"); \ No newline at end of file -- cgit