我想使用php代码将用户输入(输入文本框)添加到图像。我将非常感激,以防有人帮助我。在下面的代码中,我试图添加静态代码,但它仍然没有写在图像上。
<html>
<body>
<?php header('Content-type: image/jpeg'); ?>
<div style="padding-left:10px;width:575px; height:350px;background-color:yellow;">
<form action="" method="post">
<table style="border: 1px solid black;border-collapse: collapse;">
<tr>
<td style="border: 1px solid black;">Name:>
<td style="border: 1px solid black;">
<input style="width: 300px;" name="name" type="text"></input>
<input name="submit" type="submit" value="Submit" />
</td>
</tr>
</table>
</form>
<?php
$jpg_image = imagecreatefromjpeg('E:\structure.jpg');
$color = imagecolorallocate($jpg_image, 255, 255, 255);
$font_path = 'C:\Windows\Fonts\cambria.ttc';
// Set Text to Be Printed On Image
$text1 = "Hi Ujjwal Joshi,";
$text = "Good Morning";
imagettftext($jpg_image, 18, 0, 75, 100, $color, $font_path, $text1);
imagettftext($jpg_image, 18, 0, 100, 175, $color, $font_path, $text);
imagejpeg($jpg_image);
imagedestroy($jpg_image);
?>
</div>
</body>
</html>