Location: PHPKode > scripts > Some Chess > some-chess/image.php
<?php
//		Some Chess, a PHP multi-player chess server.
//		Copyright (C) 2006 Jon Link
session_start();
 
// Create image and define colors
$image	= ImageCreateFromJPEG("img/back.jpg");
$white	= ImageColorAllocate($image, 255, 255, 255);
$blue	= ImageColorAllocate($image, 50, 134, 250);
$black	= ImageColorAllocate($image, 0, 0, 0);

srand((double)microtime()*1000000);
$string = md5(rand(0,9999));
$theCode = substr($string, 17, 5);
$_SESSION['theCode'] = $theCode;

ImageString($image, 10, 10, 10, $theCode, $blue);

header("Content-type: image/png");
imagepng($image);
imagedestroy($image);
?>
Return current item: Some Chess