Jump to content

Using PHP + GD to create a link map


websiterepairguys

Recommended Posts

I'm not using the right terminology here, but what I am trying to do is create an image, say 1024x768, with an icon that represents a page in the middle.  Then, it will have other icons that surround it in a circular fashion.  These icons will be linked by a line indicating a relationship.

 

If you've ever used frontpage to view the link map of a site you would know what I'm referring to.  I'm at a disadvantage because of the math.

 

Basically, I know I need to:

 

calculate center point (easy)

calculate radius (easy)

draw circle (easy)

calculate points along the circle's circumference (hard)

draw icons centered on these points (medium)

draw lines connecting points to center (easy)

draw text midway between along this line indicating what the line represents (not so easy)

 

Any help?

 

Thanks

Link to comment
Share on other sites

idk

 

calculate center point (easy)

calculate radius (easy)

draw circle (easy)

i assume you have these since you put "easy"

 

calculate points along the circle's circumference (hard)

are you having 6 points? just divide 360 (degrees) by 6 (points)

then, you know the coordinates of each point:

point1 = $centerx - 0, $centery - 60;

point2 = $centerx + 60/2, $centery - 60/2;

point3 = $centerx + 60, $centery + 0;

etc. etc. etc.

 

draw icons centered on these points (medium)

if you get the points then it should be no problem

 

draw lines connecting points to center (easy)

you got it

 

draw text midway between along this line indicating what the line represents (not so easy)

divide the x/y of the point by 2 (from the center), put the text there

 

 

thats all i can ponder up.. idk if i even understand you right so if im way off then my bad lol

Link to comment
Share on other sites

calculate points along the circle's circumference (hard)

are you having 6 points? just divide 360 (degrees) by 6 (points)

then, you know the coordinates of each point:

point1 = $centerx - 0, $centery - 60;

point2 = $centerx + 60/2, $centery - 60/2;

point3 = $centerx + 60, $centery + 0;

etc. etc. etc.

 

Please tell me you aren't developing any life-critical applications

 

draw text midway between along this line indicating what the line represents (not so easy)

divide the x/y of the point by 2 (from the center), put the text there

That will find the mid point of the line but takes no account of the length of the text or its angular rotation

Link to comment
Share on other sites

^ lmao

 

draw text midway between along this line indicating what the line represents (not so easy)

divide the x/y of the point by 2 (from the center), put the text there

That will find the mid point of the line but takes no account of the length of the text or its angular rotation

 

i didnt think about angles, i was just figuring mid points.. and yes, that would work if you know the center's x/y and the points x/y..

 

if the center x/y is 0/0

and the point x/y is 50/50 (down and right)

dividing 50/2(x) and 50/2 (y) would get a midpoint between the center and outer point

Link to comment
Share on other sites

Actually

 

Come to think of it, i think this would make a damn fine Flash app for my project.

 

Use flash/ajax to pull data from server as they click on the nodes, it repains the picture.  This is a fictitious example.  The project I'm working on is much more interesting then this example. 

 

Any flash gurus out here?  [wrong board maybe but i'd be using PHP to feed the flash app so its not completely off topic ;) ]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.