ok i made a dynamic image creator, located here http://www.thematking.com/residential/doormats/vinyl-link/test4test.php
now how do i make the text write to a certain background image of my choice? i don't want the text to have any background, just overlay it onto an image, if that makes any sense.
here is the php code
<?php
// Set the content-type
header('Content-type: image/png');
$imagewidth = 500;
$imageheight = 300;
$fontsize = "72";
$fontangle = "0";
// Replace path by your own font path
$font = 'fonts/THEMATKING.TTF';
// The text to draw
$text = htmlspecialchars(stripslashes($_GET['txt']));
// Create the image
$im = imagecreatetruecolor($imagewidth, $imageheight);
// 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, 499, 399, $white);
### Get exact dimensions of text string
$box = @imagettfbbox($fontsize,$fontangle,$font,$text);
### Get width of text from dimensions
$textwidth = abs($box[4] - $box[0]);
### Get height of text from dimensions
$textheight = abs($box[5] - $box[1]);
### Get x-coordinate of centered text horizontally using length of the image and length of the text
$xcord = ($imagewidth/2)-($textwidth/2)-2;
### Get y-coordinate of centered text vertically using height of the image and height of the text
$ycord = ($imageheight/2)+($textheight/2);
// Add the text
imagettftext($im, $fontsize, $fontangle, $xcord, $ycord, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>
and here is the form code
<?php require ($_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc.php"); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>images</title>
</head>
<body>
<form name="imagetext" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET">
<label for="txt">Enter your text: </label><input type="text" value="" name="txt" size="10" maxlength="8">
<input type="submit">
</form>
<?php
if(isset($_GET['txt'])) {
$txt = htmlspecialchars(stripslashes($_GET['txt']));
echo "<img src='test4.php?txt=$txt' alt='echo image'>";
} else {
echo "<img src='test4.php' alt='elseif image'>";
}
?>
</body>
</html>
i tried replacing imagecreatetruecolor with imagecreatefrompng with the image location but it didnt work. thanks for any help, i want to get this resolved first before i move onto more complex questions with this application.