Welcome to Gaia! ::

Reply Archives
How to make those spiffy PHP sigs that have a million links! Goto Page: 1 2 3 [>] [»|]

Quick Reply

Enter both words below, separated by a space:

Can't read the text? Click here

Submit

badloki
Captain

PostPosted: Tue Nov 09, 2004 1:59 pm


Loki's Image Map Tutorial of Doom!!

~~~

Ok, I know there's already a tutorial on this located here, but I wanted to make a new one that's a bit more "user friendly" for y'all.

I hope this will help explain somethings and help anyone who wants a sig like mine to make one. So here goes.....


STEP ONE


First thing's first, AFTER you have made (or had made for you) your actual image you will use for this signature (saved as either a GIF or JPG file), you MUST download this file :

http://web.mit.edu/wuster/www/gaia/sig_mapper_0.1.zip

This is the EXACT same file (and exact same link) found in Jakabo's thread (no, it's not some virus or any crap like that. Just a ZIP file containing 2 documents for this sig). So DL them first.

After you have it DLed, you'll wanna extract and open it . Within that file are two documents:
  • map.php - runtime file
  • imagemap.class.php - class file for PHP image map

You only really need to mess with one of them for this signature. So open up map.php in Notepad (or any similar text/word processor program you have).

STEP TWO


The following text is pretty much taken directly from Jakobo's thread as it is pretty self explanatory.

Jakobo

/* Gaia Image Map Go-er
Rudolph J Heuser
*/

require_once("imagemap.class.php")

// new imageMap
$myImageMap = new imageMap()


See the above lines? Yeah, don't touch them. You need to include them in order to make it work. You don't technically need the comments line, but I have no reservations about beating you with pots and pans.


STEP THREE


Jakobo
Below that, you will see a sequence of definitions that define regions that are clickable:


$area = new Rect(84,184,189,192,"")
$myImageMap->addToMap($area)


The first line $area = new Rect(84,184,189,192,""); creates a new rectangle shape. The syntax is:
TOP_LEFT_X,TOP_LEFT_Y,BOTTOM_RIGHT_X,BOTTOM_RIGHT_Y,"URL_TO_GO_TO"
So in the above example, it will create a clickable box that goes from 84,184 to 189,192. The link goes nowhere (in mine, it is the first link in my signature).

You may then add as many of the regions as you need to.


The easiest way to get these coordinates is to open your image up in MS Paint. On your image, hover your mouse over the top left corner of where you'd like one of your links to go. You'll notice in the bottom right corner of MS Paint is a set of numbers. Those numbers are your coordinates for that point! These are referred to as "x,y" coordinates. You'll want to get coordinates for the top left corners and bottom right corners for ALL of your link areas.

If you use my current sig as an example, I had to get coordinates for the top left corner and bottom right corner of all my little black boxes.

STEP FOUR


Jakobo
See this code?

$myImageMap->setDefaultURL("")


That's the default URL. If they don't click on any of the specified regions, where exactly do they go? You don't technically need this, but it would be nice.


I recommend adding a "default url." What this means, is if anyone clicks somewhere on your sig that you did NOT defined with coordinates, then they will be taken to wherever your default url is. In my sig, I have made my default url into my quest thread. So if you click anywhere on my sig that is NOT a defined link, you will be taken to my quest thread by default.

STEP FIVE


Jakobo
Finally,

// capture X and Y from query string
$x_and_y = $_SERVER["QUERY_STRING"]
$x_and_y = explode(",",$x_and_y)
$inX = $x_and_y[0]
$inY = $x_and_y[1]
unset($x_and_y)

// echo $inX. "," . $inY;
$myImageMap->testMap($inX, $inY)

Don't touch this either. It actually captures the information about where the user clicked on your sig.


STEP SIX


Jakobo
Now all that remains is one final question: How the #^$% do I get this into my sig?!

[url=http://path/to/map.php][/url]



The most important part is the word ismap in the image tag. It specifies to the browser you will be sending the click information to the link tag. The link tag itself points to your script!


FINAL VERSION OF THE CODE


Jakobo
Care to see a final version?

/* Gaia Image Map Go-er
Rudolph J Heuser
*/

require_once("imagemap.class.php")

// new imageMap
$myImageMap = new imageMap()

// define regions

// personal web site
$area = new Rect(60,134,173,144,"http://www.felocity.org")
$myImageMap->addToMap($area)

// fansub group
$area = new Rect(60,144,153,154,"http://www.kaizoku-fansubs.com")
$myImageMap->addToMap($area)

// chord hall
$area = new Rect(60,154,219,164,"http://www.gaiaonline.com/forum/viewtopic.php?t=2049197")
$myImageMap->addToMap($area)

// the grey kitsune
$area = new Rect(60,164,253,174,"http://www.gaiaonline.com/forum/viewtopic.php?t=329330")
$myImageMap->addToMap($area)

// espy's port quest
$area = new Rect(60,174,242,184,"http://www.gaiaonline.com/forum/viewtopic.php?t=1767759")
$myImageMap->addToMap($area)

// thread link thing
$area = new Rect(60,184,262,194,"http://www.gaiaonline.com/forum/viewtopic.php?t=2469814")
$myImageMap->addToMap($area)

// wishlist trade box
$area = new Rect(236,44,493,87,"http://www.gaiaonline.com/gambino/bank.php?mode=trade&uid=507907")
$myImageMap->addToMap($area)

// load my profile if all else fails
$myImageMap->setDefaultURL("http://ian.gaiaonline.com/forum/profile.php?mode=viewprofile&u=507907")

// capture X and Y from query string
$x_and_y = $_SERVER["QUERY_STRING"]
$x_and_y = explode(",",$x_and_y)
$inX = $x_and_y[0]
$inY = $x_and_y[1]
unset($x_and_y)

// echo $inX. "," . $inY;
$myImageMap->testMap($inX, $inY)

?>


STEP SEVEN


Save this document as a PHP file once you're done adding your urls and coordinates. No other type of file will work. Only PHP.

HOSTING


Hosting the image:
Hosting the image is easy. Just use whatever you're currently using as an image host, or use any of the number of free ones on the internet.

Hosting the PHP Files:
Now you'll be asking, "Where can I host a PHP document at for free?" Well, that's a toughie. Your BEST bet is to have your OWN web space already that will host PHP, but if you don't then perhaps do a quick search on the net for places that will do it. I am currently using www.hostinganime.com to host my 2 PHP files for this sig. However, if you uwant to use this same host, you should note the following:

Jakobo
HostingAnime.com - (rename imagemap.class.php to "imagemap.php" and change the requires line in map.php. HostingAnime doesn't like .class files it seems)


You will need to upload both of those PHP files to your host. Upload the one you didn't mess with (the imagemap.class.php) AND the one that you worked on (the map.php).

FINAL REMARKS


That SHOULD be everything you need to know about making an image map for your sig. If not, please post in this thread and I (or anyone else who knows) will be more than happy to help you out!

ADVANCED IMAGE MAPS AND CONCEPTS


Here are some advanced concepts for you who would like to try them. However, I don't have any personal experience with these yet, so if you try them, you're on your own!... unless someone else around here knows about them.


DISCLAIMER


And one more thing.....
Jakobo
Mandatory Disclaimer of DOOM: I don't promise anything with these. I do place them under the Creative Commons License (Not GPL or Similar). Before you ask, I wanted to give CC a fair shake, and show that it can be used for certain applications of code and development. Please, if you develop or do more cool stuff with this foundation, put it up here so others can enjoy it too! I am also not responsible if you do something stupid and wipe out your web server. This also only extends my region class into Rect. Eventually, I will add Circle, and I would love to add Poly so that this functions exactly like a Server Side Image Map. Alas, that all takes time, and I only can sit here and bang on keys so many hours a day. ^_^

This disclaimer also applies to me and this thread!!
PostPosted: Tue Nov 09, 2004 2:04 pm


I really hope this helps y'all a bit. I hope I made this process just a bit easier to understand.

If I have left something out or stated something incorrectly, please post here and let me know!

If you have any questions or need any help, please post here and let me know!

badloki
Captain


Nopenname

Beloved Prophet

8,375 Points
  • Citizen 200
  • Befriended 100
  • Popular Thread 100
PostPosted: Tue Nov 09, 2004 2:28 pm


Or when all else fails just send all the crap to Loki xd
PostPosted: Tue Nov 09, 2004 2:33 pm


Nopenname
Or when all else fails just send all the crap to Loki xd


Hee hee!

badloki
Captain


rhondalicious

PostPosted: Tue Nov 09, 2004 2:54 pm


yay hooray! I'm eventually going to add in a chatterbox and random image to mine (for the showing off of art)
PostPosted: Tue Nov 09, 2004 4:22 pm


*glomps* I've always wondered how to do those. Here's to hoping I can do it. *is sadly technologically inept*

Illiana_Galean



Morgenmuffel

Vice Captain

Hygge Agenda

44,975 Points
  • My Feminist Agenda 500
  • Cozy Life 500
  • Friend of the Goat 100
PostPosted: Tue Nov 09, 2004 4:27 pm


^^; Loki, thank you for holding my hand and helping me do mine. (Illiana, now that I get what to do, I can help you. heart I'm technically inept too. )
PostPosted: Tue Nov 09, 2004 4:48 pm


Neko girl Manda
^^; Loki, thank you for holding my hand and helping me do mine. (Illiana, now that I get what to do, I can help you. heart I'm technically inept too. )


I don't feel so alone now. I'm going to try my first one by myself. Mainly to see if I can make heads or tails of the instructions. That and my Geek will be so proud of me! She's been trying to get me to do my own html type stuff for years. It's just now starting to click.

Illiana_Galean


KasumiAngel

3,800 Points
  • Elocutionist 200
  • Forum Dabbler 200
  • Person of Interest 200
PostPosted: Tue Nov 09, 2004 5:45 pm


You are so awesome, Loki. heart
PostPosted: Tue Nov 09, 2004 6:28 pm


Why do I need to upload the altered version and the origional? And what should the tag look like? I see the 'demo' one, but it's not clicking. HELP!

Oh god I screwed it up!!!

Illiana_Galean


Graceangel

Benevolent Phantom

17,750 Points
  • Bunny Hoarder 150
  • Cool Cat 500
  • Person of Interest 200
PostPosted: Tue Nov 09, 2004 7:31 pm


I thank you so much... however... aside from my laziness... that all just seems so complicated to me.. I'd rather get someone else to do it for me... and pay them off with donation letters... sweatdrop
PostPosted: Tue Nov 09, 2004 7:36 pm


Illiana_Galean
Why do I need to upload the altered version and the origional? And what should the tag look like? I see the 'demo' one, but it's not clicking. HELP!

Oh god I screwed it up!!!


^^ You need both because the one you don't modify tells the other what to do. From what I understand, it directs the links...I think? All I know is that it works. domokun I'll post my code so you can see. The ismap is what makes it work.

[url=http://www.hostinganime.com/mandabear/sigmap.php][/url]


Morgenmuffel

Vice Captain

Hygge Agenda

44,975 Points
  • My Feminist Agenda 500
  • Cozy Life 500
  • Friend of the Goat 100

biscuit tec

PostPosted: Wed Nov 10, 2004 1:22 am


Ehh? gonk What is a PHP sig with millions of links? I know I haven't been able to use my computer for a while but I don't think I've seen one before. Does anyone have an example?

EDIT: Ya know, since I wrote this, I've seen about 5! Sorry about that xd
PostPosted: Wed Nov 10, 2004 11:02 am


biscuit_tec
Ehh? gonk What is a PHP sig with millions of links? I know I haven't been able to use my computer for a while but I don't think I've seen one before. Does anyone have an example?

EDIT: Ya know, since I wrote this, I've seen about 5! Sorry about that xd


Me and Neko Girl Manda both have php sigs ^__^

badloki
Captain


Illiana_Galean

PostPosted: Wed Nov 10, 2004 11:06 am


Does the pic itself have to be php? Because. I think I really screwed up...Here. I'll show you.

Reply
Archives

Goto Page: 1 2 3 [>] [»|]
 
Manage Your Items
Other Stuff
Get GCash
Offers
Get Items
More Items
Where Everyone Hangs Out
Other Community Areas
Virtual Spaces
Fun Stuff
Gaia's Games
Mini-Games
Play with GCash
Play with Platinum