Hello
How would I make a script where you would input some text, then that would make images from a font file ??
Thanks
Tom
Printable View
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.
I know but i dunno GD xD
Look at my post, I editied it ;]
That wouldn't let me use a say... .ttf font file?
Yes it would.
Just upload the font to your site
And then just change: $font = 'font.ttf';
ahh yes didn't see that line ;)
Thanks :) Ill see if i can get something going xD
Now... How would I make it so that they could choose a fill and line colour like in Word for this ???