first commit

This commit is contained in:
Sam Dalfuss 2024-12-23 03:12:41 +01:00
commit 8d5e9a6f02
13 changed files with 154 additions and 0 deletions

28
css/custom.css Normal file
View file

@ -0,0 +1,28 @@
body {
background-color: #161618;
}
a {
color: #f5a9b8;
}
a:visited {
color: #5BCEFA;
}
/* Container to hold the images */
.image-container {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
gap: 2px;
margin: 20px;
}
/* Each image inside the container */
.image-container img {
width: 100%;
max-width: 300px; /* Max width of each image */
height: auto; /* Ensure aspect ratio is maintained */
object-fit: contain; /* Ensure images fit within the container */
}

BIN
hc/elftwinks.gay.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

1
hc/elftwinks.gay.txt Normal file
View file

@ -0,0 +1 @@
20

92
hc/elftwinks.php Normal file
View file

@ -0,0 +1,92 @@
<?php
// Define paths and filenames for the counter file and generated image output
$counterFile = "elftwinks.gay.txt";
$imageFile = "elftwinks.gay.png";
// Background image URL for the counter display
$backgroundImageUrl = "https://dalfuss.link/i/88x31_ElfTwinks_hit.png"; // Replace this with your actual background image URL
// Text settings to be displayed on the image
//$customText = "Hit Counter!"; // Main headline text
//$secondaryText = "Ya'll gay!"; // Secondary descriptive text
// Coordinates for positioning the text and number on the image
$textPositionX = 5; // X-coordinate for the main text
$textPositionY = 5; // Y-coordinate for the main text
$secondaryTextPositionX = 5; // X-coordinate for the secondary text
$secondaryTextPositionY = 15; // Y-coordinate for the secondary text
$numberPositionX = 8; // X-coordinate for the counter number
$numberPositionY =8; // Y-coordinate for the counter number
// RGB color definitions for text, secondary text, number, and optional frame
$textColorRGB = ['red' => 253, 'green' => 252, 'blue' => 1]; // Color for the main text
$secondaryTextColorRGB = ['red' => 0, 'green' => 255, 'blue' => 0]; // Color for the secondary text
$numberColorRGB = ['red' => 255, 'green' => 255, 'blue' => 255]; // Color for the counter number
$frameColorRGB = ['red' => 255, 'green' => 238, 'blue' => 0]; // Color for the frame
$drawFrame = false; // Boolean to toggle drawing a frame around the image
// Ensure the counter file exists, and initialize if not
if (!file_exists($counterFile)) {
file_put_contents($counterFile, "0"); // Create the file with an initial value of 0 if it doesn't exist
}
// Open the file for reading and writing (c+ creates the file if it does not exist)
$fp = fopen($counterFile, "c+");
if (flock($fp, LOCK_EX)) { // Lock to synchronize file access
// Read and increment the counter
$number = (int)fread($fp, filesize($counterFile));
$number++; // Increment the counter by 1
// Prepare the file for writing the updated counter
ftruncate($fp, 0); // Clear file content
rewind($fp); // Reset the file pointer to the start of the file
fwrite($fp, (string)$number); // Write the new counter value to the file
// Release the lock on the file
flock($fp, LOCK_UN);
}
fclose($fp); // Close the file
// Load the background image and determine its type (JPEG or PNG)
list($width, $height, $type) = getimagesize($backgroundImageUrl); // Get image dimensions and type
switch ($type) {
case IMAGETYPE_JPEG:
$backgroundImage = imagecreatefromjpeg($backgroundImageUrl); // Load JPEG image
break;
case IMAGETYPE_PNG:
$backgroundImage = imagecreatefrompng($backgroundImageUrl); // Load PNG image
break;
default:
die("Unsupported image format: " . $backgroundImageUrl); // Exit script if image format is not supported
}
// Allocate colors for the text and frame on the image
$frameColor = imagecolorallocate($backgroundImage, $frameColorRGB['red'], $frameColorRGB['green'], $frameColorRGB['blue']);
$textColor = imagecolorallocate($backgroundImage, $textColorRGB['red'], $textColorRGB['green'], $textColorRGB['blue']);
$secondaryTextColor = imagecolorallocate($backgroundImage, $secondaryTextColorRGB['red'], $secondaryTextColorRGB['green'], $secondaryTextColorRGB['blue']);
$numberColor = imagecolorallocate($backgroundImage, $numberColorRGB['red'], $numberColorRGB['green'], $numberColorRGB['blue']);
// Optionally draw a rectangular frame around the entire image
if ($drawFrame) {
imagerectangle($backgroundImage, 0, 0, $width - 1, $height - 1, $frameColor); // Draw the frame
}
// Add the main text, secondary text, and counter number to the image
imagestring($backgroundImage, 3, $textPositionX, $textPositionY, $customText, $textColor); // Draw main text
if (!empty($secondaryText)) {
imagestring($backgroundImage, 3, $secondaryTextPositionX, $secondaryTextPositionY, $secondaryText, $secondaryTextColor); // Draw secondary text if provided
}
imagestring($backgroundImage, 3, $numberPositionX, $numberPositionY, (string)$number, $numberColor); // Draw counter number
// Output the final image as a PNG file
imagepng($backgroundImage, $imageFile); // Save the image to a file
imagedestroy($backgroundImage); // Free up memory used by the image
// Set headers for the browser to interpret the output as an image
header('Content-Type: image/png'); // MIME type for PNG image
header('Content-Disposition: filename="' . $imageFile . '"'); // Suggested filename for download
readfile($imageFile); // Output the image file
// For more information, refer to the Git repository:
// https://git.cyberwa.re/revengeday/hit-counter/src/branch/main
?>

33
index.html Normal file
View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>elftwinks.gay!</title>
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css">
<link rel="stylesheet" href="./css/custom.css">
</head>
<body>
<p> You want to display your Elf Twink on elftwinks.gay? Message me on Matrix <a href="https://matrix.to/#/@dalfuss:catgirl.cloud" target="_blank">@dalfuss:catgirl.cloud!</a></p>
<div class="image-container">
<img src="./static/jax_ori.jpg" title="OC Jax by: @dalfuss@corteximplant.com Art by: orifans.com" width="300">
<img src="./static/jax_river.jpg" title="OC Jax by: @dalfuss@corteximplant.com Art by: @river_stubs (Instagram)" width="300">
<img src="./static/jax_yume.png" title="OC Jax by: @dalfuss@corteximplant.com Art by: Yume_ShiroKuro (Twitch)" width="300">
<img src="./static/moon_moon.png" title="OC Lateu by: @flatfuckfan@corteximplant.com Art by: @babyrage.art (Instagram)" width="300">
<img src="./static/endali1.png" title="OC Endali by: @endali@tech.lgbt" width="300">
<img src="./static/endali2.jpeg" title="OC Endali by: @endali@tech.lgbt Art by: artstation.com/cosmicspades" width="300">
</div>
</body>
<footer>
<p>made by <a href="https://dalfuss.link" target="_blank">Sam Dalfuss</a> with ♥ for elf twinks.</p>
<div style="position:fixed; bottom:0; height:auto; margin-top:40px; width:100%">
<img src="./hc/elftwinks.php"></img>
<a href="https://elftwinks.gay/" rel="nofollow" target="_blank">
<img src="./static/88x31_ElfTwinks.png"></img>
</a>
<a href="https://dalfuss.net/" rel="nofollow" target="_blank">
<img src="./static/88x31_dalfuss.png"></img>
</a>
</div>
</footer>
</html>

BIN
static/88x31_ElfTwinks.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
static/88x31_dalfuss.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

BIN
static/endali1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
static/endali2.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

BIN
static/jax_ori.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 MiB

BIN
static/jax_river.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

BIN
static/jax_yume.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
static/moon_moon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB