I am creating an image generating tool. According to the tool, when a user types his name the image is generated with his/her name.
The problem is that the image appears on the side of the browser window. I want it on the center of the browser. I tried <img src="path_of_php_file.php">
, but it didn't work .
My php code
<?php
$name = $_POST['imagename'];
if($_POST['imagename'] != ''){
header("Content-Type: image/png");
$name = $_POST['imagename'];
$im = @imagecreate(800, 600);
$background_color = imagecolorallocate($im, 0xFF, 0xCC, 0xDD);
$text_color = imagecolorallocate($im, 133, 14, 91);
imagestring($im, 5, 300, 300, " Hey $name Whats Up Bro ?", $text_color);
imagepng($sim);
imagedestroy($sim);
}
else echo "no image created";
?>
My html code
<html>
<body>
<form action="images.php" method="post">
Enter Your Name :<input type="text" name="imagename">
<br></br>
<input type="submit" name="submit">
</form>
</body>
</html>
It would be really helpful if you guys tell me how to make my generated image to center. Thanks