dynamic image from form
Posted: Wed Jul 12, 2006 5:12 am
G'day,
I have a form where data from a teamspeak server is entered, then a picture is selected and then the form is submitted to a php file that takes the variables from this form and makes a dynamic image. My problem is that this information isnt stored, so when that php file is closed the image doesnt exsist anymore. How do I make it to when the form is submitted, it saves the info into some file where the php file uses this to create an image that is stored as a png? Here is what I have so far:
file1 ts_view.html
file2 ts_view.php
Hope this question isnt too complicated. 
I have a form where data from a teamspeak server is entered, then a picture is selected and then the form is submitted to a php file that takes the variables from this form and makes a dynamic image. My problem is that this information isnt stored, so when that php file is closed the image doesnt exsist anymore. How do I make it to when the form is submitted, it saves the info into some file where the php file uses this to create an image that is stored as a png? Here is what I have so far:
file1 ts_view.html
Code: Select all
<html>
<form action="ts_view.php" method="post">
TS IP : <input type="text" name="username" size="20" /><br />
UDP Port: <input type="text" name="port" size="20" />(if not known contact your TS server provider)<br />
TCP Port: <input type="text" name="tcp" size="20" />(if not known contact your TS server provider)<br />
Title: <input type="text" name="title" size="20" /><br />
URL <input type="text" name="url" size="20" /><p> </p>
<select name="test[]" multiple="multiple">
<option value="/teamspeakimg3.png">Image3</option>
<option value="/teamspeakimg4.png">Image4</option>
<option value="/teamspeakimgb5.png">Image5</option>
<option value="/teamspeakimgb6.png">Image6</option>
<option value="/teamspeakimgb7.png">Image7</option>
<option value="/teamspeakimgb8.png">Image8</option>
<option value="/teamspeakimgb9.png">Image9</option>
<option value="/teamspeakimgb10.png">Image10</option>
<option value="/teamspeakimgb11.png">Image11</option>
</select> <input type="submit" name="submit" value="Submit" /> </pre> </p>
</form>
</html>Code: Select all
<?php
require("cyts.class.php");
$ip = $_POST['username'];
$portnum = $_POST['port'];
$urls = $_POST['url'];
$titler = $_POST['title'];
$tcps = $_POST['tcp'];
$cyts = new cyts;
//Parameters are: IP-Address, TCP-Queryport, UDP-Port
$cyts->connect("$ip", $tcps, $portnum) or die ("Unable to connect to TeamSpeak-server");
header("Content-type: image/png");
$images1 = $_POST['test'];
foreach($images1 as $temp)
{
$temp;
}
$bg = $temp;
$im = @ImageCreateFromPNG($bg);
$width =1;
$fontsize = 2;
$font = 2;
$fonta = 3;
$black = imagecolorallocate($im, 255, 255, 255);
$srvinfo = $cyts->info_serverInfo();
$playerlist = $cyts->info_playerNameList( );
$tsuser = $cyts->info_playerList();
$list = $cyts->info_channelList();
$tsusers = $cyts->info_playerList();
$tsserv = $cyts->info_serverInfo();
$time =(($srvinfo["server_uptime"])*(1/60)*(1/60)) ;
$time = round($time,0);
imagestring($im, 2, 80 , 87,$users, $black);
$love=$time;
$titler = substr($titler , 0,23)."";
imagestring($im, 6, 10, 10,$titler , $black);
$urls = substr($urls , 0, 36)."";
imagestring($im, 2, 69, 40,$urls , $black);
imagestring($im, 2, 69, 70,$ip , $black);
$srvinfo["server_welcomemessage"] = substr($srvinfo["server_welcomemessage"] , 0, 15)."..";
imagestring($im, 2, 69, 100,$srvinfo["server_welcomemessage"] , $black);
imagestring($im, 2, 348, 74, $srvinfo["server_currentusers"] , $black);
imagestring($im, 2, 345, 95,$srvinfo["server_maxusers"] , $black);
imagestring($im, 2, 45, 128,$time , $black);
imagestring($im, 2, 230, 128,$srvinfo["server_currentchannels"] , $black);
imagestring($im, 2, 120, 128, $srvinfo["server_bwoutlastmin"], $black);
imagePNG($im);
ImageDestroy;
?>