hai. ich hab die php4u stats und würde die ausgabe etwas formatieren.. möchte dass die ausgabe waagerecht verläuft. dazu brauche ich für jedes datum eine grafik, in der das datum horizontal drinsteht. kann man das mit php irgentwie machen?
das datum ist so gespeichert:
(es fehlt die jeweils führende null also zb 9.9.2003 statt 09.09.2003)
$o['day']
$o['month']
$o['year']
Waagrecht, horizontal oder doch senkrecht? ;)
Waagrecht --> imagestring()
Senkrecht --> imagestringup()
int imagestringup ( resource im, int font, int x, int y, string s, int col )
was ist resource im und welches farbenformat muss ich benutzen?
kannst du vll einfach das oben gezeigte beispiel mal in die funktion einsetzen?
header('Content-type: image/png');
$s = sprintf ("%04d-%02d-%02d", $o['year'],$o['month'], $o['day']); # String
$x_size = 10; #Breite
$y_size = 50; #Höhe
$IMGResource = ImageCreate();
$white= imagecolorallocate ($text_image, 255,255, 255); # weisse Schriftfarbe
imagestringup (IMGResource , 1, $x_size, $y_size, $s, $white);
ImagePNG($IMGResource);
Ungetestet... Müsste aber hinkommen ;)
// resource ist die Bildressource von ImageCreate().
irgentwie nicht
http://xyz-70.bierquartier.de/test/6.1/ppl.php
<?
header('Content-type: image/png');
$x_size = 24; #Breite
$y_size = 44; #Höhe
$IMGResource = ImageCreate();
$black = imagecolorallocate ($text_image, 0, 0, 0);
imagestringup ($IMGResource , 1, $x_size, $y_size, "ttttttt", $black);
ImagePNG($IMGResource);
?>
oh...
<?
header('Content-type: image/png');
$x_size = 24; #Breite
$y_size = 44; #Höhe
$IMGResource = ImageCreate();
$black = imagecolorallocate ($IMGResource, 255, 255, 255);
imagestringup ($IMGResource , 1, $x_size, $y_size, "ttttttt", $black);
ImagePNG($IMGResource);
?>
Da hab ich doch tatsächlich was vergessen ô_Ò
scheinimmer noch nicht so zu funktionieren
http://xyz-70.bierquartier.de/test/6.1/ppl.php
Ein Blick in den Quelltext:
Quote
<br />
<b>Warning</b>: Wrong parameter count for imagecreate() in <b>/www/htdocs/thexyz-70/test/6.1/ppl.php</b> on line <b>5</b><br />
<br />
<b>Warning</b>: imagecolorallocate(): supplied argument is not a valid Image resource in <b>/www/htdocs/thexyz-70/test/6.1/ppl.php</b> on line <b>6</b><br />
<br />
<b>Warning</b>: imagestringup(): supplied argument is not a valid Image resource in <b>/www/htdocs/thexyz-70/test/6.1/ppl.php</b> on line <b>7</b><br />
<br />
<b>Warning</b>: imagepng(): supplied argument is not a valid Image resource in <b>/www/htdocs/thexyz-70/test/6.1/ppl.php</b> on line <b>8</b><br />
Darfst selber debuggen.. is nicht allzu schwer :P
header('Content-type: image/png');
$x_size = 24; #Breite
$y_size = 44; #Höhe
$IMGResource = imagecreate($x_size, $y_size); ///DA WAR DOCH DER FEHER ODER?
$black = imagecolorallocate ($IMGResource, 255, 255, 255);
imagestringup ($IMGResource , 1, $x_size, $y_size, "ttttttt", $black);
ImagePNG($IMGResource);
SO gehts auch nicht...
weiss keiner eine lösung?
so sollte es funktionieren:
<?php
header ("Content-type: image/png");
$im = ImageCreate (24, 44);
$background_color = ImageColorAllocate ($im, 255, 255, 255);
$text_color = ImageColorAllocate ($im, 233, 14, 91);
ImageStringup ($im, 1, 5, 5, "TTTTT", $text_color);
ImagePNG ($im);
?>
geht immer noch nicht...
<br />
<b>Warning</b>: Wrong parameter count for imagecreate() in <b>/www/htdocs/thexyz-70/test/6.1/ppl.php</b> on line <b>5</b><br />
<br />
<b>Warning</b>: imagecolorallocate(): supplied argument is not a valid Image resource in <b>/www/htdocs/thexyz-70/test/6.1/ppl.php</b> on line <b>6</b><br />
<br />
<b>Warning</b>: imagestringup(): supplied argument is not a valid Image resource in <b>/www/htdocs/thexyz-70/test/6.1/ppl.php</b> on line <b>7</b><br />
<br />
<b>Warning</b>: imagepng(): supplied argument is not a valid Image resource in <b>/www/htdocs/thexyz-70/test/6.1/ppl.php</b> on line <b>8</b><br />
bei mir schon http://b-arnold.net/test.php
hm mist
poste nochmal genau den code von deiner datei (du hast da ja ein datum stehen)
<?php
header ("Content-type: image/png");
$im = ImageCreate (24, 50);
$background_color = ImageColorAllocate ($im, 255, 255, 255);
$text_color = ImageColorAllocate ($im, 233, 14, 91);
ImageStringup ($im, 1, 2, 48, "22-11-2006", $text_color);
ImagePNG ($im);
?>
xyz-48n hast du wohl ne seehr eigenartige Implementierung der GD Bibliothek ;(
Bissu sicher, dass das auch genau so in dem Skript steht, das du aufrufst?
Nicht, dass da noch der alte Code drin is..
Der content-type sollte übrigens direkt vor imagepng() gesetzt werden, da mögliche Fehlermeldungen sonst untergehen.
mit dem 2. code von ben gehts irgentwie...
wie kann ich in dem text auch rauten udn sonderzeichen verwenden?
> wie kann ich in dem text auch rauten udn sonderzeichen verwenden?
Diese einfach in den zu zeichnenden String schreiben.. für den anspruchsvolleren Entwickler empfiehlt sich
imagettftext(), womit du in einem zuvor geladenen TTF auf dein Bild schreiben kannst. Auch senkrecht.
http://xyz-70.bierquartier.de/test/6.1/stats/image.php?text=STF#U
geht net.. gibts das # zeichen in der schriftart nicht oder läuft da was falsch
Ach so.. ne, # is in einer HTTP URL ein Sonderzeichen und muss mit urlencode() kodiert werden.
okay. noch ne frage zu dem gleichen thema.
ich habe so das gefühl, dass das hier
http://xyz-70.bierquartier.de/test/6.1/stats/stats/stats.php?counter_action=stats meinen server irgentwie ziemlich stark belastet. wie baut man in die image funktion oben noch eine caching funktion ein?