Shop-Hilfe.com
-


Hinweise


Antwort
 
LinkBack Themen-Optionen Thema durchsuchen Thema bewerten
Alt 25.02.2003, 16:28   #1
TP-Member
 
Benutzerbild von uedde001
 
Registriert seit: Jul 2002
Ort: Pforzheim
uedde001 macht alles soweit korrekt

verkettung von variablen


Hallo leutz,

ich bin zwar nicht so der coding-crack aber ich versuche mich an und wieder mit php.

Ich möchte mit php eine grafik erstellen, deren füllung und randfarbe immer harmonieren, sich aber bei jedem Seitenaufruf ändern.

Dazu hab ich mich unter anderem der funktion
rand (INT_MIN,INT_MAX) bedient.

Desweiteren habe ich mit imagecolorallocate 3 x 2 Farbpaare ( $col1 + $tex1 usw )die harmonieren definiert.

wie schaffe ich es das, ich wenn die funktion rand mir eine zahl. z.b 2 ausgibt ich diese mit der variable $tex UND $col verbinde, und entsprechend damit auch weiterarbeiten kann.

Am besten poste ich noch im anschluss meinen Quellcode.

Damit dürfte der eine oder andere was anfangen können.

Vielen Dank bis hierher


U


<?php
header ("Content-type: image/png");
$im = @ImageCreate (200, 100)
or die ("Kann keinen neuen GD-Bild-Stream erzeugen");


$background_color = ImageColorAllocate ($im, 255, 255, 0);

$colrand = ImageColorAllocate ($im, 0, 0, 0);

$col1 = ImageColorAllocate ($im, 0, 0, 0);
$col2 = ImageColorAllocate ($im, 255, 212, 102);
$col3 = ImageColorAllocate ($im, 255, 255, 255);
$tex1 = ImageColorAllocate ($im, 255, 255, 255);
$tex2 = ImageColorAllocate ($im, 187, 160, 0);
$tex3 = ImageColorAllocate ($im, 0, 0, 0);


$ip = $HTTP_SERVER_VARS["REMOTE_ADDR"];
$host = gethostbyaddr($ip);

$fw = rand (1,3)

$$colfw = "$col.$fw"
$$texfw = $tex.$fw

imagearc( $im, 7, 7, 16, 16, 180, 270, $colrand );
imagearc( $im, 191, 7, 16, 16, 270, 360, $colrand );
imagearc( $im, 7, 91, 16, 16, 90, 180, $colrand );
imagearc( $im, 191, 91, 16, 16, 0, 90, $colrand );
imageline ( $im, 8, 0, 190, 0, $colrand );
imageline ( $im, 199, 4, 199, 94, $colrand );
imageline ( $im, 194, 99, 4, 99, $colrand );
imageline ( $im, 0, 94, 0, 6, $colrand );
imagefill( $im, 3, 3,$ $colfw);
imagecolortransparent( $im, $background_color );
ImageString ($im, 2, 5, 20, " IP: ".$ip,$$texfw);
// ImageString ($im, 2, 5, 30, "HOST: ".$host, $text_color);
ImagePNG ($im);
?>
__________________
"der Einäugige ist unter den blinden König"
Meiner -> Dual XEON 3.06 GHZ, 2GB PC266 RAM
uedde001 ist offline   Mit Zitat antworten


Alt 26.02.2003, 00:32   #2
TP-Member
 
Benutzerbild von uedde001
 
Registriert seit: Jul 2002
Ort: Pforzheim
uedde001 macht alles soweit korrekt
hmm keiner am start, der sich mit PHP / coding allgemein auskennt ??

__________________
"der Einäugige ist unter den blinden König"
Meiner -> Dual XEON 3.06 GHZ, 2GB PC266 RAM
uedde001 ist offline   Mit Zitat antworten
Alt 26.02.2003, 14:34   #3
TP-Insider
 
Registriert seit: Jun 2001
Ort: Berlin
deck16 ist auf einem guten Weg
hilft dir das?

$fw = rand (1,3);

$col1 = "bild1";
$col2 = "bild2";
$col3 = "bild3";

$var_c = "col".$fw;

$$var_c; [inhalt der zB var $col1 ]
deck16 ist offline   Mit Zitat antworten
Alt 26.02.2003, 16:08   #4
TP-Member
 
Benutzerbild von uedde001
 
Registriert seit: Jul 2002
Ort: Pforzheim
uedde001 macht alles soweit korrekt
Hi Deck, danke für die Antwort, geht leider nicht .

Das Ding sieht jetzt so aus :

<?php
header ("Content-type: image/png");
$im = @ImageCreate (200, 100)
or die ("Kann keinen neuen GD-Bild-Stream erzeugen");


$background_color = ImageColorAllocate ($im, 255, 255, 0);

$colrand = ImageColorAllocate ($im, 0, 0, 0);

$col1 = ImageColorAllocate ($im, 0, 0, 0);
$col2 = ImageColorAllocate ($im, 255, 212, 102);
$col3 = ImageColorAllocate ($im, 255, 255, 255);
$tex1 = ImageColorAllocate ($im, 255, 255, 255);
$tex2 = ImageColorAllocate ($im, 187, 160, 0);
$tex3 = ImageColorAllocate ($im, 0, 0, 0);


$ip = $HTTP_SERVER_VARS["REMOTE_ADDR"];
$host = gethostbyaddr($ip);

$fw = rand (1,3)

$var_c = 'col'.$fw;
$var_t = "tex".$fw;
$$var_c;
$$var_t;


imagearc( $im, 7, 7, 16, 16, 180, 270, $colrand );
imagearc( $im, 191, 7, 16, 16, 270, 360, $colrand );
imagearc( $im, 7, 91, 16, 16, 90, 180, $colrand );
imagearc( $im, 191, 91, 16, 16, 0, 90, $colrand );
imageline ( $im, 8, 0, 190, 0, $colrand );
imageline ( $im, 199, 4, 199, 94, $colrand );
imageline ( $im, 194, 99, 4, 99, $colrand );
imageline ( $im, 0, 94, 0, 6, $colrand );
imagefill( $im, 3, 3,$ $var_c);
imagecolortransparent( $im, $background_color );
ImageString ($im, 2, 5, 20, " IP: ".$ip,$var_t);
// ImageString ($im, 2, 5, 30, "HOST: ".$host, $text_color);
ImagePNG ($im);
?>

Leider bringt er mir in line 24 nen Parse error.

Gruß

U
__________________
"der Einäugige ist unter den blinden König"
Meiner -> Dual XEON 3.06 GHZ, 2GB PC266 RAM
uedde001 ist offline   Mit Zitat antworten
Alt 26.02.2003, 16:38   #5
TP-Insider
 
Registriert seit: Jun 2001
Ort: Berlin
deck16 ist auf einem guten Weg
erstmal fehlt hier

$fw = rand (1,3)

ein ; am ende.

musst du nicht unten die $$vars nehmen?
deck16 ist offline   Mit Zitat antworten
Alt 26.02.2003, 17:07   #6
TP-Member
 
Benutzerbild von uedde001
 
Registriert seit: Jul 2002
Ort: Pforzheim
uedde001 macht alles soweit korrekt
so gehts jetzt zumindest ohne Fehler

<?php
header ("Content-type: image/png");
$im = @ImageCreate (200, 100)
or die ("Kann keinen neuen GD-Bild-Stream erzeugen");


$background_color = ImageColorAllocate ($im, 255, 255, 0);

$colrand = ImageColorAllocate ($im, 0, 0, 0);

$col1 = ImageColorAllocate ($im, 0, 0, 0);
$col2 = ImageColorAllocate ($im, 255, 212, 102);
$col3 = ImageColorAllocate ($im, 255, 255, 255);
$tex1 = ImageColorAllocate ($im, 255, 255, 255);
$tex2 = ImageColorAllocate ($im, 187, 160, 0);
$tex3 = ImageColorAllocate ($im, 0, 0, 0);


$ip = $HTTP_SERVER_VARS["REMOTE_ADDR"];
$host = gethostbyaddr($ip);

$fw = rand (1,3);

$var_c = "col".$fw;
$var_t = "tex".$fw;
$$var_c;
$$var_t;


imagearc( $im, 7, 7, 16, 16, 180, 270, $colrand );
imagearc( $im, 191, 7, 16, 16, 270, 360, $colrand );
imagearc( $im, 7, 91, 16, 16, 90, 180, $colrand );
imagearc( $im, 191, 91, 16, 16, 0, 90, $colrand );
imageline ( $im, 8, 0, 190, 0, $colrand );
imageline ( $im, 199, 4, 199, 94, $colrand );
imageline ( $im, 194, 99, 4, 99, $colrand );
imageline ( $im, 0, 94, 0, 6, $colrand );
imagefill( $im, 3, 3,$ $$var_c);
imagecolortransparent( $im, $background_color );
// ImageString ($im, 2, 5, 20, " IP: ".$ip,$$var_t);
ImageString ($im, 2, 5, 20, $var_c." ".$$var_c." ".$var_t." ".$$var_t." ".$ip,$colrand);

// ImageString ($im, 2, 5, 30, "HOST: ".$host, $text_color);
ImagePNG ($im);
// echo $$var_c;.$$var_t

?>


bekomme als wert von $var_c z.b. col1 ausgegeben.. ich bräuchte aber $col1.

Any Ideas ??
__________________
"der Einäugige ist unter den blinden König"
Meiner -> Dual XEON 3.06 GHZ, 2GB PC266 RAM
uedde001 ist offline   Mit Zitat antworten
Alt 26.02.2003, 17:26   #7
TP-Member
 
Benutzerbild von uedde001
 
Registriert seit: Jul 2002
Ort: Pforzheim
uedde001 macht alles soweit korrekt
<?php
header ("Content-type: image/png");
$im = @ImageCreate (200, 100)
or die ("Kann keinen neuen GD-Bild-Stream erzeugen");


$background_color = ImageColorAllocate ($im, 255, 255, 0);

$colrand = ImageColorAllocate ($im, 0, 0, 0);

$col1 = ImageColorAllocate ($im, 0, 0, 0);
$col2 = ImageColorAllocate ($im, 255, 212, 102);
$col3 = ImageColorAllocate ($im, 255, 255, 255);
$tex1 = ImageColorAllocate ($im, 255, 255, 255);
$tex2 = ImageColorAllocate ($im, 187, 160, 0);
$tex3 = ImageColorAllocate ($im, 0, 0, 0);


$ip = $HTTP_SERVER_VARS["REMOTE_ADDR"];
$host = gethostbyaddr($ip);

$fw = rand (1,3);

$var_c = "$"."col".$fw;
$var_t = "$"."tex".$fw;
$$var_c;
$$var_t;


imagearc( $im, 7, 7, 16, 16, 180, 270, $colrand );
imagearc( $im, 191, 7, 16, 16, 270, 360, $colrand );
imagearc( $im, 7, 91, 16, 16, 90, 180, $colrand );
imagearc( $im, 191, 91, 16, 16, 0, 90, $colrand );
imageline ( $im, 8, 0, 190, 0, $colrand );
imageline ( $im, 199, 4, 199, 94, $colrand );
imageline ( $im, 194, 99, 4, 99, $colrand );
imageline ( $im, 0, 94, 0, 6, $colrand );
imagefill( $im, 3, 3, $$var_c);
imagecolortransparent( $im, $background_color );
ImageString ($im, 2, 5, 20, $var_c." ".$var_t." ".$ip,$colrand);
ImagePNG ($im);

?>

jetzt bekomm ich zwar als wert von $var_c den Wert z.b. $col1
aber die füllfarbe ändert sich trotzdem nicht.

Ich riech´s schon.. wir sind kurz davor.... *schnüffel*
__________________
"der Einäugige ist unter den blinden König"
Meiner -> Dual XEON 3.06 GHZ, 2GB PC266 RAM
uedde001 ist offline   Mit Zitat antworten
Antwort

  Aktuelles Thema
  TP Hilfe Forum > Web-Editoren & Coding > Traum-Dynamik
verkettung von variablen verkettung von variablen
« Problem mit DopDown | php, frames, tabellen, layer ..... »

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu


Alle Zeitangaben in WEZ +2. Es ist jetzt 04:01 Uhr.

Powered by: vBulletin Version 3.7 (Deutsch)
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd. / Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.
Traum-Projekt.com | Suchen | Archiv | Impressum | Kontakt | | | Nach oben |



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67