# \[PHP\]-dynamic image with variable text

**URL:** https://forum.kirupa.com/t/php-dynamic-image-with-variable-text/224307
**Category:** programming
**Created:** [May 1, 2007, 1:41am UTC](https://forum.kirupa.com/t/php-dynamic-image-with-variable-text/224307 "2007-05-01T01:41:12Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Flash\_Man1](https://avatars.discourse-cdn.com/v4/letter/f/8797f3/32.png) [@Flash\_Man1](https://forum.kirupa.com/u/Flash_Man1)
#### Post date: [May 1, 2007, 1:41am UTC](https://forum.kirupa.com/t/php-dynamic-image-with-variable-text/224307/1 "2007-05-01T01:41:12Z")

</div>

Hi all,

I have a static image in a HTML Page and i want to type my name in a input field and press send and i want to see my name appear in the image.

I can do this directly from the php page using a ?name=John Sample at the end of my url

How can i do this directly from the html page by pressing send?

here is my php page code:

```php
<?php
header("Content-type: image/jpeg");
$string = $_GET['name'];
$im = imagecreatefromjpeg("view.jpg");
$black = imagecolorallocate($im, f, f, f);
$px = (imagesx($im) - 20 * strlen($string)) / 2;
imagestring($im, 20, $px, 100, $string, $black);
imagepng($im);
imagedestroy($im);
?>

```

and the HTML its just standard input field code and plain text underneath saying send.

Any ideas??

Thanks in advance! 😃
