Sourcecode

Liveparticle/image.php


image.php

<?php
$scale = 0.75;
$type = 2;

$w = 1920;
$h = 1080;

if (isset($_GET['ad'])){
    $w = 728 / 0.5;
    $h = 92 / 0.5;
    $scale = 0.5;
}

$im = imagecreate($w * $scale,$h * $scale);
$schriftart = $_SERVER["DOCUMENT_ROOT"] . "/arial.ttf";
$col[0] = imagecolorallocate($im, 192, 192, 192);
$col[1] = imagecolorallocate($im, 192, 0, 0);
$col[2] = imagecolorallocate($im, 0, 192, 0);
$col[3] = imagecolorallocate($im, 0, 0, 192);
imagefill ($im, 0, 0, $col[0]);
$val = rand(1000 * $scale, 25000 * $scale);
for($i = 0; $i < $val * $scale; $i++){
    $col[] = imagecolorallocate($im, rand(0, 255), rand(0, 255), rand(0, 255));
    imagefilledellipse($im, rand(0,$w * $scale), rand(0,$h * $scale), 5 * $scale, 5 * $scale, $col[rand(1, 10)]);
}

if (!isset($_GET['ad'])){
    //imagestring($im, 5 * $scale, 10 * $scale, $w * $scale - 20 * $scale ** $scale, "(c) 2024 - tmcz.de", $col[3]);
    imagettftext($im, 10, 0, 1, $h * $scale - 5, $col[3], $schriftart, "(c) 2024 - tmcz.de");
    //imagettftext($im, 15, 0, 1, 16, $col[3], $schriftart, "TMCZ Live Partikel");
}else{
    imagettftext($im, 15, 0, 1, 16, $col[3], $schriftart, "TMCZ Live Partikel");
    imagettftext($im, 15, 0, $w * 0.5 - 240, $h * 0.5 - 1, $col[3], $schriftart, "https://liveparticle.tmcz.de/");
}

if ($type == 1 && $scale > 0.25){
    header("Content-Type: image/jpeg");
    imagejpeg($im);
}elseif($type == 2){
    header("Content-Type: image/png");
    imagepng($im);
}else{
    header("Content-Type: image/gif");
    imagegif($im);

}

imagedestroy($im);