Nothing really spectacular.
Output:PHP Code:<?php
// During typical usage, these would be POST data.
$name = 'Bob';
$message = "Hello!\nThis is an example message!\n\nChange as required.";
function imagestringshade($img, $fnt, $inx, $iny, $str) {
global $s1, $s2;
imagestring($img, $fnt, $inx, $iny--, $str, $s2);
imagestring($img, $fnt, $inx, $iny, $str, $s1);
}
function addmessageline(&$tmp, $key) {
global $im, $f1;
$iny = (int)(10*$key)+35;
imagestringshade($im, $f1, 27, $iny, $tmp);
}
$im = imagecreatefromgif('back.gif');
$s1 = imagecolorallocate($im, 0x7F, 0x55, 0x2B);
$s2 = imagecolorallocate($im, 0xFF, 0xF3, 0xB7);
$f1 = imageloadfont('voltar.gdf');
imagestringshade($im, $f1, 22, 127, date("j-m-y"));
imagestringshade($im, $f1, 275-strlen($name)*7, 127, $name);
$messages = explode("\n", wordwrap($message, 40, "\n"));
array_walk($messages, 'addmessageline');
header('content-type: image/gif');
imagegif($im);
imagedestroy($im); // Can output to a file.
?>
Obviously in a real situation, you'd have a form and be validating the data. However, implementing that would be far from trivial.



Reply With Quote


+REP Back.