Navigation
Main
 
Code

[Back to list] [Execute]

<?php
// Velox Letum (2005)
// elementation@gmail.com
// http://www.nanoshock.net
 
// Create truecolor image...required for alpha layering
$image = imagecreatetruecolor(350, 350);
 
// Find height and width
$height = imagesy($image);
$width = imagesx($image);
 
// Define colors
$white = imagecolorallocate($image, 255, 255, 255);
$black = imagecolorallocate($image, 0, 0, 0);
$red = imagecolorallocatealpha($image, 255, 0, 0, 64);
$green = imagecolorallocatealpha($image, 0, 255, 0, 64);
$blue = imagecolorallocatealpha($image, 0, 0, 255, 64);
 
// Load Font
$font = "fonts/verdana.ttf";
 
 // Background
imagefilledrectangle($image, 0, 0, $height, $width, $white);
 
// Ellipses
imagefilledellipse($image, ceil(rand(50,250)), ceil(rand(50,250)), 125, 125, $red);
imagefilledellipse($image, ceil(rand(50,250)), ceil(rand(50,250)), 125, 125, $green);
imagefilledellipse($image, ceil(rand(50,250)), ceil(rand(50,250)), 125, 125, $blue);
 
// Write text to image
imagettftext ($image, 8, 0, $width-140, $height-2, $black, $font, "Ellipses and Alpha Colors.");
 
// Output headers, image, and destroy image data
header("Content-type: image/png");
imagepng($image);
imagedestroy($image);
?>
© 2005 Nanoshock.net. All rights reserved.