php - Display GD image on another page -
i want add text image via form..
i not have experience gd, i've gotten add text, , show image header content type... problem is, can display that, , on page, no other content...
if return ajax call that'd awesome, though i've not worked ajax either..
code:
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 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 png image imagepng($image); //header("location:index.php?p=images&display=true"); // , free memory imagedestroy($image);
you may include <img src='test.php' />
html code fore gettingphp generated image on it. may use param pass test image, this:
<!-- html code (my generated php --> <img src='test.php?name=my+text' />
for test.php:
//replace $text = $_post['name']; $text = $_get['name'];
Comments
Post a Comment