我有我的这个代码,它实际上是从我的系统上传图像,还创建一个透明背景的图像,然后合并这两个图像。但是现在我希望我能为用户提供从我提供的列表中选择字体的选项,并且还应该能够从我给定的颜色列表中选择颜色。我不明白如何为用户提供字体和颜色的选择。请在我的代码中建议我进行一些编辑。
<?php
//Set the Content Type
header("Content-type: image/png");
#dispaly the image
$file=$_GET['file'];
$text=$_GET["text"];
// echo file_get_contents($file);
$im = imagecreatetruecolor(400, 400);
$black = imagecolorallocate($im, 0 , 0, 0);
$blue = imagecolorallocate($im, 0, 0, 255);
imagecolortransparent($im, $black);
//text to draw
//$text="helllooooooooooooooooooooo";
//font path
$font = '/usr/share/fonts/truetype/droid/DroidSans.ttf';
// Add the text
imagettftext($im, 15, 0, 15, 15, $blue, $font, $text);
$dest=imagecreatefrompng($file);
//$src=imagecreatefrompng($im);
imagealphablending($dest, false);
imagesavealpha($dest, true);
imagecopymerge($dest, $im, 15, 15, 0, 0, 400, 400, 100);
imagepng($dest);
imagedestroy($dest);
imagedestroy($im);
?>
这是我的表格
<!DOCTYPE html>
<html>
<head>
<title>Image Editor</title>
</head>
<body>
<center><h1><u>Add Text To Your Image..!!</u></h1></center>
<form action="upload.php" method="get" enctype="multipart/form-data">
<h3>Select image to upload:<br></h3>
<input type="file" name="fileToUpload" id="fileToUpload" accept="image/*">
<br><br>
<input type="text" name="text" placeholder="Enter your text">
<br><br>
<input type="submit" value="Upload Image" name="submit">
</form>
</body>
</html>
对于颜色,我将如何使用表格?