[SOLVED]imagefilledpolygon

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Phorem
Forum Newbie
Posts: 20
Joined: Sun Mar 06, 2005 3:58 am

[SOLVED]imagefilledpolygon

Post by Phorem »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I had a look around on Google and through these forums but i have yet ben able to figure this out.

And yes, my PHP skill is lacking...

What i have is an image that i want to create a filled polygon on top of - that isn't the problem. I can create the ploygons fine.

My problem lies in the fact that the data for the array of points won't "echo" into the imagefilledpolygon string.
For example..

I have an array that i created from the results of the data base looping through long and lat coords and plotting them onto the screen.

Code: Select all

$results = array();

while($row = mysql_fetch_array($result)){

	$GID = $row['GID'];
	$lat = $row['Y1'];
	$lon_result = $row['X1'];
	$lon = ((-1)*($lon_result));
	
	$pt = getlocationcoords($lat, $lon, $scale_x, $scale_y);

	$x1 = $pt["x"];
	$y1 = $pt["y"];

$results[] = "$x1,$y1,";

}
Now, i can "echo" the $results onto the screen

Code: Select all

echo implode($results);
But i can't seem to get my string of data to work in the magefilledpolygon string.

Code: Select all

$points = implode($results);
$vertices = count($points) / 2;
//echo $points;

imagefilledpolygon($im, $points, $vertices , $red);
It is the $points data that i want to "echo" into the imagefilledpolygon string. But i can't "echo" the string there....i tried. Maybe i am not formating the result properly, but if echo the points to screen then copy and paste them into the imagefilledpolygon string, the image works fine.
Again, i just need a way to echo the data points into the imagefilledpolygon from my array "$results" that i created.

Any help would be great. Thank you.


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Last edited by Phorem on Sun Dec 03, 2006 10:03 pm, edited 1 time in total.
Phorem
Forum Newbie
Posts: 20
Joined: Sun Mar 06, 2005 3:58 am

Post by Phorem »

Please!

I have even resorted to shameless Bumps!!
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

Phorem wrote:Please!

I have even resorted to shameless Bumps!!
and please don't.


[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:4. All users of any level are restricted to bumping (as defined here) any given thread within twenty-four (24) hours of its last post. Non-trivial posts are not considered bumping. A bump post found in violation will be deleted, and you may or may not recieve a warning. Persons bumping excessively be considered as spammers and dealt with accordingly.
if someone knows the answer to your question, they will get to it.
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Post by SidewinderX »

Code: Select all

$results = array();

while($row = mysql_fetch_array($result)){

        $GID = $row['GID'];
        $lat = $row['Y1'];
        $lon_result = $row['X1'];
        $lon = ((-1)*($lon_result));
       
        $pt = getlocationcoords($lat, $lon, $scale_x, $scale_y);

        $x1 = $pt["x"];
        $y1 = $pt["y"];

$results[] = $x1;
$results[] .= $y1;
}
is that what your trying to do?
Phorem
Forum Newbie
Posts: 20
Joined: Sun Mar 06, 2005 3:58 am

Post by Phorem »

Yes that worked perfectly.

Thank you very, very much. :lol:
Post Reply