I made this banner generator and i want the text to be replaced with images.
how do i make it so the letter 'a' is replaced with 'a.png'?
INDEX.PHP
<form action="image.php"><br>
<input type="text" name="text" id="text" value="text goes here">
<input type="radio" value="blue" name="background"checked><img src='images/blue.png' width='100'>
<input type="radio" value="blue" name="background"><img src='images/red.png' width='100'>
<input type="radio" value="blue" name="background"><img src='images/green.png' width='100'>
<input type="submit" id="submit" value="Create My Banner!">
</form>
IMAGE.PHP
<?php
$height = 283;
$width = 718;
$fontsize = 130;
$text = $_GET['text'];
$bg = $_GET['background'];
$image = imagecreatefrompng("images/$bg.png");
$color = imagecolorallocate( $image, 255, 215, 50);
$font = "LifeCraft.ttf";
$textwidth = $width;
$textheight;
while ( true ) {
$box = imageTTFbbox ( $fontsize, 2, $font, $text );
$textwidth = abs( $box[2] );
$textbodyheight =( abs($box[7]) )+55;
if ( $textwidth < $width - 20 )
break;
$fontsize--;
}
$pngXcenter = (int) ( $width/2 );
$pngYcenter = (int) ( $height/2 );
imageTTFtext( $image, $fontsize, 0,
(int) ($pngXcenter-($textwidth/2)),
(int) ($pngYcenter+(($textbodyheight)/2) ),
$color, $font, $text );
header("content-type: image/png");
imagepng($image);
?>