Navigation
Main
 
Code

[Back to list] [Execute]

<?php
// Velox Letum (2005)
// elementation@gmail.com
// http://www.nanoshock.net
 
$im = imagecreatetruecolor(256, 255); // Create image
 
// Get width and height
$img_width = imagesx($im);
$img_height = imagesy($im);
 
// Define some common colors
$black    = imagecolorallocate($im, 0, 0, 0);
$white    = imagecolorallocate($im, 255, 255, 255);
$grey     = imagecolorallocate($im, 110, 110, 110);
 
imagefilledrectangle($im, 0, 0, $img_width, $img_height, $black); // Background color
imagestring ($im, 1, 64, 128, "I wrote text to an image.", $white); // Write string to photo
 
Header("Content-type: image/jpeg"); // Tell the browser the data is a JPEG image
 
imagejpeg($im); // Output Image
imagedestroy($im); // Flush Image
?>
© 2005 Nanoshock.net. All rights reserved.