Hallo zusammen, ich habe ein kleines Problem mit einem Signaturengenerator.
Ich habe zwei Dateien, die index.php, auf der sich ein Formular befindet, dort soll auch das erstellte Bild angezeigt werden.
Sowie die absig.php in der sich der Code für die Erstellung des Bildes befindet.
Was ich nun möchte ist, ich gebe Daten in das Formular ein, wähle ein Hintergrundbild aus und klicke auf "absenden" jetzt möchte ich das die absig.php aufgerufen wird, die Werte aus dem Formular übergeben werden und anhand dieser ein Bild erstellt wird, die Datei soll in einem Verzeichnis gespeichert werden und dann auf der index.php Seite über dem Formular angezeigt werden.
Dort soll dann auch kein Bild mit dem Namen "absif.php&ohne_ende_werte" sein, sondern das Bild "erstellt12345.png".
Als letzte "herrausforderung" würde ich gerne die eingegebenen Werte aus dem Formular in den Feldern behalten, bisher habe ich das Problem das nach dem Absenden die Eingabefelder und Pulldownmenüs wieder leer sind bzw auf alten Zustand stehen.
Hier mal ein bisschen Code meiner bisherigen Arbeit.
Die index.php ;
Die absig.php ;
Das ganze dann mal als Live-Ansicht
http://www.aion-base.de/~files/siggenbeta/
Mit dem Bild erstellen klappt alles ganz gut ->
Nur heißt das Bild nicht erstellt12345.png sondern
Das Bild selbst als Datei zu erstellen ist auch kein Problem, dazu müsste ich nur das auskommentierte beim imagepng wegnehmen.
ich weißt jetzt nur nicht wie ich das Bild dann auf der index.php auch wieder als .png anzeigen lassen kann und das möglichst ohne das Formular zu leeren...
Ich hoffe ihr habt genug Infos, wenn nicht immer her mit den Fragen
Ich habe zwei Dateien, die index.php, auf der sich ein Formular befindet, dort soll auch das erstellte Bild angezeigt werden.
Sowie die absig.php in der sich der Code für die Erstellung des Bildes befindet.
Was ich nun möchte ist, ich gebe Daten in das Formular ein, wähle ein Hintergrundbild aus und klicke auf "absenden" jetzt möchte ich das die absig.php aufgerufen wird, die Werte aus dem Formular übergeben werden und anhand dieser ein Bild erstellt wird, die Datei soll in einem Verzeichnis gespeichert werden und dann auf der index.php Seite über dem Formular angezeigt werden.
Dort soll dann auch kein Bild mit dem Namen "absif.php&ohne_ende_werte" sein, sondern das Bild "erstellt12345.png".
Als letzte "herrausforderung" würde ich gerne die eingegebenen Werte aus dem Formular in den Feldern behalten, bisher habe ich das Problem das nach dem Absenden die Eingabefelder und Pulldownmenüs wieder leer sind bzw auf alten Zustand stehen.
Hier mal ein bisschen Code meiner bisherigen Arbeit.
Die index.php ;
PHP-Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Siggen Aion-Base</title>
<script src="http://www.aion-base.de/siggen/302pop.js" type="text/javascript"></script>
<style type="text/css">
<!--
.desc {
text-align: left;
}
#bg {
position: relative;
}
#text {
position:absolute;
left:0px;
top:0px;
}
#eingabe{
width:580px;
height:360px;
margin:1px;
clear:both;
}
#ausgabe{
height:110px;
width:415px;
margin:0 auto;
float:left;
}
#banner{
width:450px;
margin:0 auto;
}
#seite{
width:630px;
height:100%;
font-size: small;
}
#seite #eingabe form table tr th {
text-align: left;
}
#seite form #eingabe table tr th {
text-align: left;
}
#beschr {
font-size: 0.8em;
}
-->
</style>
</head>
<body>
<div id="seite">
<div id="ausgabe">
<p>
<?php function RandomString($length=4,$chars='abcdefghijklmnpqrstuvwxyz'){
$result = '';
for($i=0;$i<$length;$i++) { $result .= $chars[mt_rand(0,strlen($chars)-1)]; }
return $result;
}
$code = md5(RandomString(5));
$charname = '?char='.rawurlencode($_REQUEST[char]);
$klasse = '&klasse='.rawurlencode($_REQUEST[klasse]);
$fraktion = '&fraktion='.$_REQUEST[fraktion];
$legion = '&legion='.rawurlencode($_REQUEST[legion]);
$banner = '&banner='.$_REQUEST[banner];
$face = '&face='.$_REQUEST[face];
$rahmen = '&rahmen='.$_REQUEST[rahmen];
?>
<img border="0" width="400" height="100" src="
<?php
$url = 'absig.php'.$charname.$klasse.$fraktion.$legion.$banner.$face.$rahmen.'&mdsumme='.$code;
echo($url);
?>
">
</p>
</div>
<span id="beschr">Speichert euch das Bild bei Fertigstellung bitte ab.<br>
Rechtsklick auf das Bild -> "Bild speichern unter"<br>
Es wird nicht auf unserem Server gespeichert und kann somit auch nicht verlinkt werden. </span><br>
<p>
</p>
<form method="post" enctype="application/x-www-form-urlencoded">
<div id="eingabe">
<table width="573" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="164" height="35" scope="col">Charaktername: </th>
<th width="392" scope="col"><input name="char" type="text" size="20" class="textbox"></th>
</tr>
<tr>
<th height="35" class="desc" scope="row">Klasse:</th>
<td><select name="klasse" id="idklasse">
<option>Gladiator</option>
<option>Templer</option>
<option>Assassine</option>
<option value="Jäger">Jäger</option>
<option value="Beschwörer">Beschwörer</option>
<option>Zauberer</option>
<option>Kantor</option>
<option>Kleriker</option>
</select></td>
</tr>
<tr>
<th height="35" scope="row">Fraktion:</th>
<td><select name="fraktion" id="fraktion">
<option>Elyos</option>
<option>Asmodier</option>
</select></td>
</tr>
<tr>
<th height="35" scope="row">Legion:</th>
<td><input name="legion" type="text" size="20" class="textbox"></td>
</tr>
<tr>
<th height="35" scope="row">Face</th>
<td><select name="face" id="face">
<option value="">None</option>
<option value="face1.png">Face 1</option>
<option value="face2.png">Face 2</option>
<option value="face3.png">Face 3</option>
<option value="face4.png">Face 4</option>
<option value="face5.png">Face 5</option>
<option value="face6.png">Face 6</option>
<option value="face7.png">Face 7</option>
<option value="face8.png">Face 8</option>
<option value="face9.png">Face 9</option>
</select></td>
</tr>
<tr>
<th height="35" scope="row">Rahmen</th>
<td><select name="rahmen" id="rahmen">
<option value="">None</option>
<option value="rahmen1.png">Rahmen 1</option>
<option value="rahmen2.png">Rahmen 2</option>
<option value="rahmen3.png">Rahmen 3</option>
</select></td>
</tr>
</table>
<br>
<input type="submit" class="button" value="Signatur erstellen">
</div>
<div id="banner">
<table width="440">
<tr>
<td width="30" height="110"><label>
<input type="radio" name="banner" value="siggenbg4.png" id="RadioGroup1_00">
</label></td>
<td width="410"><img src="/~files/siggenbeta/preview/pre_siggibg4.jpg" alt="" width="400" height="100"></td>
</tr>
<tr>
<td height="110"><label>
<input type="radio" name="banner" value="siggenbg5.png" id="RadioGroup1_0" >
</label></td>
<td><img src="/~files/siggenbeta/preview/pre_siggibg5.jpg" alt="" width="400" height="100"></td>
</tr>
<tr>
<td height="110"><label>
<input type="radio" name="banner" value="siggenbg6.png" id="RadioGroup1_1">
</label></td>
<td><img src="/~files/siggenbeta/preview/pre_siggibg6.jpg" alt="" width="400" height="100"></td>
</tr>
<tr>
<td height="110"><label>
<input type="radio" name="banner" value="siggenbg7.png" id="RadioGroup1_2">
</label></td>
<td><img src="/~files/siggenbeta/preview/pre_siggibg7.jpg" alt="" width="400" height="100"></td>
</tr>
<tr>
<td height="110"><label>
<input type="radio" name="banner" value="siggenbg8.png" id="RadioGroup1_3">
</label></td>
<td><img src="/~files/siggenbeta/preview/pre_siggibg8.jpg" alt="" width="400" height="100"></td>
</tr>
<tr>
<td height="110"><label>
<input type="radio" name="banner" value="siggenbg9.png" id="RadioGroup1_4">
</label></td>
<td><img src="/~files/siggenbeta/preview/pre_siggibg9.jpg" alt="" width="400" height="100"></td>
</tr>
<tr>
<td height="110"><label>
<input type="radio" name="banner" value="siggenbg10.png" id="RadioGroup1_5">
</label></td>
<td><img src="/~files/siggenbeta/preview/pre_siggibg10.jpg" alt="" width="400" height="100"></td>
</tr>
<tr>
<td height="110"><label>
<input type="radio" name="banner" value="siggenbg11.png" id="RadioGroup1_6">
</label></td>
<td><img src="/~files/siggenbeta/preview/pre_siggibg11.jpg" alt="" width="400" height="100"></td>
</tr>
<tr>
<td height="110"><label>
<input type="radio" name="banner" value="siggenbg12.png" id="RadioGroup1_7">
</label></td>
<td><img src="/~files/siggenbeta/preview/pre_siggibg12.jpg" alt="" width="400" height="100"></td>
</tr>
<tr>
<td height="110"><label>
<input type="radio" name="banner" value="siggenbg13.png" id="RadioGroup1_8">
</label></td>
<td><img src="/~files/siggenbeta/preview/pre_siggibg13.jpg" alt="" width="400" height="100"></td>
</tr>
<tr>
<td height="110"><label>
<input type="radio" name="banner" value="siggenbg14.png" id="RadioGroup1_9">
</label></td>
<td><img src="/~files/siggenbeta/preview/pre_siggibg14.jpg" alt="" width="400" height="100"></td>
</tr>
</table>
</div>
<br>
<input type="submit" class="button" value="Signatur erstellen">
</form>
</div>
</body>
</html>
PHP-Code:
<?php
header("Content-Type: image/png; charset=iso-8859-1");
// Variablen aus index.php Übergabe nehmen
$banner = $_GET['banner'];
$face = $_GET['face'];
$rahmen = $_GET['rahmen'];
$fraktion = $_GET['fraktion'];
$mdsumme = $_GET['mdsumme'];
// Fixes the encoding for class
function umlWorkaround1($klasse) {
$klasse = (string) $klasse;
$klasse_out = "";
for($i = 0, $n = strlen($klasse); $i < $n; $i++) {
$klasse_out .= "&#" . ord($klasse[$i]) . ";";
}
return $klasse_out;
}
$klasse = rawurldecode($_GET['klasse']);
$klasse = umlWorkaround1($klasse);
// Fixes the encoding for char
function umlWorkaround2($char) {
$char = (string) $char;
$char_out = "";
for($i = 0, $n = strlen($char); $i < $n; $i++) {
$char_out .= "&#" . ord($char[$i]) . ";";
}
return $char_out;
}
$char = rawurldecode($_GET['char']);
$char = umlWorkaround2($char);
// Fixes the encoding for legion
function umlWorkaround3($legion) {
$legion = (string) $legion;
$legion_out = "";
for($i = 0, $n = strlen($legion); $i < $n; $i++) {
$legion_out .= "&#" . ord($legion[$i]) . ";";
}
return $legion_out;
}
$legion = rawurldecode($_GET['legion']);
$legion = umlWorkaround3($legion);
//Erster Aufruf, preload Siggipreview
if($banner == "")
{
$im = imagecreatefrompng("http://www.aion-base.de/~files/siggenbeta/bg/siggenbg4.png");
}
else
{
$im = imagecreatefrompng("http://www.aion-base.de/~files/siggenbeta/bg/".$banner);
}
$user_width = imagettfbbox(7.5, 0, "fonts/visitor.ttf", $klasse);
$size_char = 24;
//Position Klassenname
$x_value = 5;
$y_value = 95;
//Position Charaktername
$x_value_1 = 155;
$y_value_1 = 30;
//Position Legion
$x_value_3 = 185;
$y_value_3 = 55;
//Position Fraktion
$x_value_4 = $user_width[2] + 22;
$y_value_4 = 95;
//Position Spruch
$x_value_5 = 221;
$y_value_5 = 89;
// Fonts
$klassenfont = "fonts/visitor.ttf" ;
$fraktionsfont = "fonts/visitor.ttf" ;
$color = imagecolorallocate($im, 0, 0, 0);
$charcolor = imagecolorallocate($im, 0, 0, 0);
$textcolor2 = imagecolorallocate($im, 255, 255, 255);
$legioncolor = imagecolorallocate($im, 0, 0, 0);
// imagecopy(hauptbild, zu kopierndes bild, start x axis im hauptbild, start y axis im hauptbild, 0, 0, größe vom kopierten bild breite , größe vom kopierten bild höhe ); // aion-base.de
if($face != "")
{
$im2 = imagecreatefrompng("http://www.aion-base.de/~files/siggenbeta/side/".$face);
imagecopy($im, $im2, 4, 4, 0, 0, 392,92); // aion-base.de
}
if($rahmen != "")
{
$im2 = imagecreatefrompng("http://www.aion-base.de/~files/siggenbeta/side/".$rahmen);
imagecopy($im, $im2, 4, 4, 0, 0, 392,92); // aion-base.de
}
//Kontur Klasse
$fontfile = $klassenfont;
$cattitle = $klasse." -";
$fontsize = 7.5 ;
$x = $x_value;
$y = $y_value;
imagettftext($im, $fontsize, 0, $x-1, $y+1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x, $y+1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x+1, $y+1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x-1, $y, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x, $y, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x+1, $y, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x-1, $y-1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x, $y-1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x+1, $y-1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, 7.5, 0, $x_value, $y_value, $color, $klassenfont, $klasse." -"); // Klassenname
//Kontur Charaktername
$fontfile = "fonts/font1.ttf";
$cattitle = $char;
$fontsize = $size_char ;
$x = $x_value_1;
$y = $y_value_1;
imagettftext($im, $fontsize, 0, $x-1, $y+1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x, $y+1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x+1, $y+1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x-1, $y, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x, $y, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x+1, $y, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x-1, $y-1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x, $y-1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x+1, $y-1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $size_char, 0, $x_value_1, $y_value_1, $charcolor, "fonts/font1.ttf", $char); // Charaktername
//Kontur Legion
$fontfile = "fonts/font1.ttf";
$cattitle = $legion;
$fontsize = 15 ;
$x = $x_value_3;
$y = $y_value_3;
imagettftext($im, $fontsize, 0, $x-1, $y+1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x, $y+1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x+1, $y+1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x-1, $y, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x, $y, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x+1, $y, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x-1, $y-1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x, $y-1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x+1, $y-1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, 15, 0, $x_value_3, $y_value_3, $legioncolor, "fonts/font1.ttf", $legion); // Legion
//Kontur Fraktion
$fontfile = $fraktionsfont;
$cattitle = $fraktion;
$fontsize = 7.5 ;
$x = $x_value_4;
$y = $y_value_4;
imagettftext($im, $fontsize, 0, $x-1, $y+1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x, $y+1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x+1, $y+1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x-1, $y, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x, $y, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x+1, $y, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x-1, $y-1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x, $y-1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x+1, $y-1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, 7.5, 0, $x_value_4, $y_value_4, $color, $fraktionsfont, $fraktion); // Fraktion
// Kontur aion-base.de
$fontfile = $fraktionsfont;
$cattitle = "Aion-Base.de";
$fontsize = 7.5 ;
$x = 335;
$y = 95;
imagettftext($im, $fontsize, 0, $x-1, $y+1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x, $y+1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x+1, $y+1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x-1, $y, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x, $y, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x+1, $y, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x-1, $y-1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x, $y-1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, $fontsize, 0, $x+1, $y-1, $textcolor2, $fontfile, $cattitle);
imagettftext($im, 7.5, 0, $x, $y, $color, $fraktionsfont, "Aion-Base.de"); // aion-base.de
//erstelle Bild (Dateierstellung erstmall deaktiviert
imagepng($im);//, 'sigs/'.$mdsumme.'aion_base_sig.png',8);
imagedestroy($im);
?>
http://www.aion-base.de/~files/siggenbeta/
Mit dem Bild erstellen klappt alles ganz gut ->
Nur heißt das Bild nicht erstellt12345.png sondern
Code:
http://www.aion-base.de/~files/siggenbeta/absig.php?char=Garog&klasse=Gladiator&fraktion=Elyos&legion=Eternally&face=face1.png&rahmen=rahmen1.png&banner=siggenbg21.png
Code:
imagepng($im);//, 'sigs/'.$mdsumme.'aion_base_sig.png',8); --> imagepng($im, 'sigs/'.$mdsumme.'aion_base_sig.png',8);
Ich hoffe ihr habt genug Infos, wenn nicht immer her mit den Fragen
Kommentar