フォームを介して画像にテキストを追加したい..
私はGDの経験はありませんが、テキストを追加し、ヘッダーコンテンツタイプの画像を表示するようになりました...それに関する問題は、それを表示することしかできず、それをページ上でのみ表示できることです、他のコンテンツはありません...
ajax を使ったことがなくても、ajax 呼び出しからそれを返すことができれば、それは素晴らしいことです..
コード:
index.php:::::::
elseif($_GET['p'] == "Images"){
?>
<form action="test.php" method="post">
<input type="text" name="name" value="">
<input type="submit" name="submit" value="submit" >
</form>
<?php
if(!isset($_GET['display'])) $_GET['display'] = "false";
if($_GET['display'] == "true"){
echo "<img src='test.php' />";
}
}
test.php:::::
$font = "Images/Pokedex.TTF"; // full path to your font file
$text = $_POST['name'];
$image = imagecreatefrompng("Images/1.png");
$color = imagecolorallocate($image, 0, 0, 0);
imagettftext($image, 12, 0, 20, 235, $color, $font, $text);
// define content-type header
header("Content-type: image/png");
// output image as a png image
imagepng($image);
//header("Location:index.php?p=Images&display=true");
// and free the memory
imagedestroy($image);