Hello
How would I make a script where you would input some text, then that would make images from a font file ??
Thanks
Tom

PHP GD
Couldn't be bothered to write my own code, so yeah here is the PHP.net tutorial with a change to make it save the image.
Make a file called text.php and inside it put:
Make a file called index.php and in it have a form send the data to text.php and name the form which you type the text into called "text".PHP Code:<?php
// Set the content-type
header("Content-type: image/gif");
// Create the image
$im = imagecreatetruecolor(400, 30);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);
// The text to draw
$text = $_POST['text'];
// Replace path by your own font path
$font = 'font.ttf';
// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
$rand = rand(0, 60000);
// Using imagepng() results in clearer text compared with imagejpeg()
imagegif($im,'$rand.gif');
imagedestroy($im);
?>
Enjoy.
Last edited by Invent; 30-03-2007 at 08:02 PM.
Look at my post, I editied it ;]
Yes it would.
Just upload the font to your site
And then just change: $font = 'font.ttf';
Want to hide these adverts? Register an account for free!