I was playing around and made this... but it can be usefull... if you'll ever need to do such things.
Ah yes descritption.
It'll draw pretty much anything as long as you give coordinates.
It'll give you the length of the line and return the point at it's middle.
For polygons it'll return the area (with the exception that the polygion intersects with itself) and perimeter.
An example is given below.
<?php
$poly = new polygon(
new point(0, 0),
new point(0, 1),
new point(1, 2),
new point(2, 2),
new point(2, 3),
new point(3, 4),
new point(4, 4),
new point(5, 3),
new point(5, 0),
new point(4, 0),
new point(4, 3),
new point(3, 3),
new point(3, 2),
new point(2, 1),
new point(1, 1)
);
$point = new point(4, 4);
$line = new line(new point(-2, 2), new point(4, 5));
$poly2 = new polygon(
new point(0, 0),
new point(0, 4),
$point,
new point(4, 0),
new point(3, 0),
new point(3, 3),
new point(1, 3),
new point(1, 0)
);
Be usefull for a extremely random captcha image. Or, if you really into it you could spend the time to make image generators, as in,if you have ever used that doll maker that makes dolls that look similar to the 'homies' in the quarter machines. It uses PHP to draw the characters (all designs are unditable) allowing you to customize colors and add a shirt logo. Pretty neat stuff.
I'm not going to give you a preview because of the security risks...eval($_GET) eek!
__________________ Jalenack.com .:. YWDA Founder .:. Rounded Corners Maker 1.1! .:. My Blog
The hardest thing about teaching is not knowing the right answers, but knowing the right questions - Elisabeth Klein
Pretty buttons does not a great website make.
Evaling input is not secure (I know that - don't copy that). If you want to secure it you could use this class that evaluates math securely.
grid::func() was the last method I've added (all I wanted was to draw polygons) so if you want to use it in public it would be wise to secure it.
__________________
I'm not sure if this was any help, but I hope it didn't make you stupider.
Experience is something you get just after you really need it. PHP Installation Guide Feedback welcome.
i get an error with this one, no image displays.. error..
Quote:
[26-Apr-2006 09:55:27] PHP Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in c:\phpdev5\www\public\new folder\class.php on line 4
[26-Apr-2006 09:55:27] PHP Fatal error: Cannot instantiate non-existent class: grid in c:\phpdev5\www\public\new folder\graph.php on line 4
tried this on two servers running different php versions .. still no luck,
any thoughts? Im using the second code and M's class.php
You need at least PHP5 to run the code.
PHP4 does not recognise the public/private/protected properties (it uses var only) and that's why you get the parse error.
__________________
I'm not sure if this was any help, but I hope it didn't make you stupider.
Experience is something you get just after you really need it. PHP Installation Guide Feedback welcome.