<?php
header('Content-type: image/png');
function float_rand($Min, $Max, $round=0){
  if ($Min > $Max) {
    $Min=$Max;
    $Max=$Min;
  } else {
    $min=$Min;
    $max=$Max;
  }
  $randomfloat = $min + mt_rand() / mt_getrandmax() * ($max - $min);
  if($round > 0)$randomfloat = round($randomfloat,$round);
  return $randomfloat;
}
$width = 360;
$height = 240;
$offsetwidth = ($width - 250);
$offsetheight = ($height - 50);
$dw = ($width * float_rand(0.75,1.6,2));
$dh = ($height * float_rand(0.75,1.6,2));
$ndw = ( float_rand(-0.2,.2,2) * $dw);
$ndh = ( float_rand(-0.2,.2,2) * $dh);
$png_image = imagecreate($width, $height);
$grey = imagecolorallocate($png_image, rand(0, 255), rand(0, 255), rand(0, 255));
$green = imagecolorallocate($png_image, rand(0, 255), rand(0, 255), rand(0, 255));
function f() {
  return rand(0,255);
}
imagefilltoborder($png_image, 0, 0, $grey, $grey);
$o = 1;
$j = rand(3,9);
while ( $o <= $j ) {
  $m = rand(1,4);
  if ( $m == 1 ) {
    imageellipse ($png_image, float_rand($ndw,$dw), float_rand($ndw,$dw), float_rand(0,$width), float_rand(0,$height), imagecolorallocate($png_image, rand(0, 255), rand(0, 255), rand(0, 255)));
  }
  elseif ( $m == 2 ) {
    imagefilledellipse ($png_image, float_rand($ndw,$dw), float_rand($ndw,$dw), float_rand(0,$width), float_rand(0,$height), imagecolorallocate($png_image, rand(0, 255), rand(0, 255), rand(0, 255)));
  }
  elseif ( $m == 3 ) {
    $totry = rand(3,6);
    $i = 1;
    $poly_points=array();
    while ( $i <= $totry ) {
      array_push($poly_points,float_rand($ndw,$dw), float_rand($ndh,$dh));
      $i++;
    }
    imagepolygon ($png_image, $poly_points, $totry, imagecolorallocate($png_image, rand(0, 255), rand(0, 255), rand(0, 255)));
  } else {
    $totry = rand(3,6);
    $i = 1;
    $poly_points=array();
    while ( $i <= $totry ) {
      array_push($poly_points,float_rand($ndw,$dw), float_rand($ndh,$dh));
      $i++;
    }
    imagefilledpolygon ($png_image, $poly_points, $totry, imagecolorallocate($png_image, rand(0, 255), rand(0, 255), rand(0, 255)));
  }
  $o++;
}
imagestring($png_image, 5, rand(0,$offsetwidth), rand(0,$offsetheight), 'The Jollo IRC Network', imagecolorallocate($png_image, rand(0, 255), rand(0, 255), rand(0, 255)));
imagestring($png_image, 5, rand(0,$offsetwidth), rand(0,$offsetheight), 'irc.jollo.org sslport 9999', imagecolorallocate($png_image, rand(0, 255), rand(0, 255), rand(0, 255)));
imagepng($png_image);
imagedestroy($png_image);
?>