Log in

View Full Version : Making An Text Generator



:Edzy
17-02-2007, 02:14 PM
How would i go about making a text generator where an image is linked to a letter so if u type 'A' an A image would come up

Dentafrice1
17-02-2007, 03:25 PM
<?php
// create a 100*30 image
$im = imagecreate(100, 30);

// white background and blue text
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);

// write the string at the top left
imagestring($im, 5, 0, 0, "Hello world!", $textcolor);

// output the image
header("Content-type: image/png");
imagepng($im);
?>


http://www.skylightlobby.com/text.php

:Edzy
17-02-2007, 07:11 PM
OMG I LOVE YOU

for that but

1 how would i change the font and background transparency

and 2 would this work


<?php
// create a 100*30 image
$im = imagecreate(100, 30);

// white background and blue text
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);

// write the string at the top left
imagestring($im, 5, 0, 0, "<?php include("wotever.php"); ?>", $textcolor);

// output the image
header("Content-type: image/png");
imagepng($im);
?>

Dentafrice1
17-02-2007, 07:14 PM
Text.php:


<?php
// create a 100*30 image
$im = imagecreate(100, 30);

// white background and blue text
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);

$string = file_get_contents("wotever.php");
// write the string at the top left
imagestring($im, 5, 0, 0, $string, $textcolor);

// output the image
header("Content-type: image/png");
imagepng($im);
?>


wotever.php


Testing 123

or you can have wotever.html

:Edzy
17-02-2007, 07:26 PM
<?php
// create a 100*30 image
$im = imagecreate(100, 30);

// white background and blue text
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);
$font = '__bmreciept.ttf' << WOULD THAT WORK LOLZ

$string = file_get_contents("wotever.php");
// write the string at the top left
imagestring($im, 5, 0, 0, $string, $textcolor);

// output the image
header("Content-type: image/png");
imagepng($im);
?>

Dentafrice1
17-02-2007, 07:41 PM
Then you would have to use imagettftext instead of imagestring, it has way more varialbes depending on the font your using ;)

:Edzy
17-02-2007, 07:48 PM
;( confuzzled :S

so like:

<?php
// create a 100*30 image
$im = imagecreate(100, 30);

// white background and blue text
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);
$font = imagettftext(__bmreciept.ttf);

$string = file_get_contents("wotever.php");
// write the string at the top left
imagestring($im, 5, 0, 0, $string, $textcolor);

// output the image
header("Content-type: image/png");
imagepng($im);
?>

Want to hide these adverts? Register an account for free!