| | | | |
| | |
| PHP Code Flüsterer Registriert seit: 21.08.2005 Beiträge: 4682 PHP-Kenntnisse: Fortgeschritten | |
| | |
| Gast
Beiträge: n/a
| du hast glück ich hab sowas vor kurzer zeit mal geschrieben: mathfunction.php (berechnet und zeichnet den Graphen) Code: <?php
header ("Content-type: image/jpeg");
if($_GET['term']){
$term=$_GET['term'];
}
else {
$term="\$x";
}
$im = ImageCreate(1000,1000);
if($im) {
$bg_color = ImageColorAllocate ($im, 240, 240, 240);
$fg_color = ImageColorAllocate ($im, 0, 0, 0);
$fg_color2 = ImageColorAllocate ($im, 200, 200, 200);
for($a=25;$a<=1000;$a+=25){
imageline($im,$a,0,$a,1000,$fg_color2);
}
for($b=25;$b<=1000;$b+=25){
imageline($im,0,$b,1000,$b,$fg_color2);
}
imageline($im,0,500,1000,500,$fg_color);
imageline($im,500,0,500,1000,$fg_color);
imageline($im,550,504,550,496,$fg_color);
imageline($im,450,504,450,496,$fg_color);
imageline($im,496,550,504,550,$fg_color);
imageline($im,496,450,504,450,$fg_color);
for($x=-10;$x<=10;$x=$x+0.02){
$pixel_x=500+50*$x;
if($x==0){
$pixel_y=0;
} else {
eval("\$pixel_y=500-round(50*(" . $term . "),2);");
}
imagesetpixel($im,$pixel_x,$pixel_y,$fg_color);
}
imagejpeg($im);
}
?>
Code: <?php
if(isset($_REQUEST['term'])){
?>
Neuen Term angeben
[img]mathfunction.php?term=<?php echo rawurlencode($_REQUEST['term']) ?>[/img]
<?php
} else {
?>
<form action="math.php" method="get">
Funktionsterm: <input type="text" name="term">
<input type="submit" name="los" value="Los!">
</form>
<?php
}
?>
da kannst du es testen, statt x einfach $x eingeben :wink: link zu -2(x+3)-2 : http://six-base.de/scripts/math.php?...9-2&los=Los%21 |
| Themen-Optionen | |
| Thema bewerten | |
|
|
Ähnliche Themen | ||||
| Thema | Autor | Forum | Antworten | Letzter Beitrag |
| Interaktive Navigationskarte zeichnen | PHP Tipps 2005-2 | 5 | 06.05.2009 21:33 | |
| Linie zeichnen | anno | PHP Tipps 2007 | 12 | 23.03.2007 09:04 |
| Graphen erstellen - Achseneinteilung | Der_Gerhard | PHP Tipps 2006 | 2 | 09.09.2006 10:36 |
| Zeichnen mit PHP | <Daniel> | PHP Tipps 2006 | 5 | 24.08.2006 16:54 |
| diagramme zeichnen | flflfl | PHP Tipps 2006 | 1 | 13.04.2006 21:20 |
| Funktion in Koordinatensystem zeichnen - Finde Fehler nicht | PHP Tipps 2005-2 | 5 | 20.10.2005 22:05 | |
| kreis zeichnen ??? | kid01 | HTML, Usability und Barrierefreiheit | 3 | 27.07.2005 17:37 |
| [JS] Zeichnen | konsti | HTML, Usability und Barrierefreiheit | 2 | 15.04.2005 16:34 |
| Habe Probleme bei der Erstellung eines dynamischen Graphen.. | PHP-Fortgeschrittene | 1 | 11.11.2004 12:43 | |

Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.