net-board.net Archiv

Normale Version: dynamische Bider
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Hi


man kannja mir php auch bilder erzeugen.

so wie hier: *pattex kommt dir das bild bekannt vor? gg ich hoffe ich darf das posten*

[Bild: ferien.php?.png]


ich gehe davon aus, dass du ein Skript mit datumsfunktion geschrieben hast, dass die Tage biszu den Sommerferien speichert.

Das Ergebnis speicherst du in einer Variable.

Und dann benuzt du die IMG Funktion zu erzeugen eines Bildes.
du erzeugst ein Bild mit der Aufschrift "noch $variable Tage ..."

ok jetzt die Frage

wie funktioniert die bildfunktion?
Ich poste dir am besten mein ganzes Script.
Ich habe es etwas erweitert. Für die IMG Funktion allein gibt es hier einen Thread:
Brunners Signatur

Mein Script:
Code:
<?php
$monat =  date("m",time());
    $tag = date("d",time());

$juni = 30 - $tag;
$juni1 = $juni + 19;
$juli = 19 - $tag;

if($monat=="06"){
$text[] = "Noch $juni1 Tage bis zu den Sommerferien!"; }
if($monat=="07"){
if($juli!="0"){
$text[] = "Noch $juli Tag/e bis zu den Sommerferien!";
}
else{
$text[] = "SOMMERFERIEN!";
}
}

$font = 3;

$max_len = 0;
foreach($text as $str) {
if(strlen($str)>$max_len) {
$max_len = strlen($str);
}
}
$width = ImageFontWidth($font) * $max_len;
$height = ImageFontHeight($font)*count($text);
$im = imagecreate($width, $height);
$black = ImageColorAllocate ($im, 0, 0, 0);
// Hintergrundfarbe
$white = ImageColorAllocate ($im, 0, 0, 0);
$orange = ImageColorAllocate ($im, 0, 0, 0);
imagecolortransparent ($im, imagecolorat ($im, 0, 0));
$y = 0;
foreach($text as $str) {
imagestring ($im, $font, 0, $y, $str, $orange);
$y = $y + ImageFontHeight($font);
}
Imagepng($im);

?>

Diese Funktion ist für das Bild ab gdlib 1 wenn ich mich recht erinnere:
Code:
$font = 3;

$max_len = 0;
foreach($text as $str) {
if(strlen($str)>$max_len) {
$max_len = strlen($str);
}
}
$width = ImageFontWidth($font) * $max_len;
$height = ImageFontHeight($font)*count($text);
$im = imagecreate($width, $height);
$black = ImageColorAllocate ($im, 0, 0, 0);
// Hintergrundfarbe
$white = ImageColorAllocate ($im, 0, 0, 0);
$orange = ImageColorAllocate ($im, 0, 0, 0);
imagecolortransparent ($im, imagecolorat ($im, 0, 0));
$y = 0;
foreach($text as $str) {
imagestring ($im, $font, 0, $y, $str, $orange);
$y = $y + ImageFontHeight($font);
}
Imagepng($im);
ahh danke :-D
vielleicht kommt das aus dem post von pattex net ganz raus aber auf dem server muss php mit der gdlib installiert sein Wink