Rotating Signatures


Ever wanted a signature for your forum accounts that changed randomly every time the page was loaded? Not sure how to do it? Well read on and be enlightened…

What you need

Well first of all, you need somewhere to host your images. They need to be in the same directory as each other, and you need control over the naming of the files (so somewhere like Imageshack won’t work).

Your host also needs to be running PHP.

Method:

As you know, to place an image in your signature, you use [IMG] [/IMG] tags around the path of the image. Essentially, what you will be doing in this case, is rather than referencing an image file directly, you reference a .php file which calls a random image for your signature. With me so far?

Ok, first, name all your image files you want in your rotation logically (use 1.jpg, 2.jpg, 3.jpg etc.), then upload them all into the same folder on the server.

Open notepad or any other basic text editor and paste in the following code, courtesy of this site on a single line:

Save the file as “rotate.php” (remember to change the file extension from .txt to .php), and upload this file to the same directory as your images.

Now alter your signature on the forum as [IMG]http://somehost/sigs/rotate.php[/IMG] you should have a fully functioning rotating signature!

Notes:

Some forums have restrictions on the type of file you can use as a signature image. Sometimes, the .php extension is restricted, which obviously causes problems when using the above method. If this is the case, use the following method: paste the code below into a blank notepad document and save the resulting file as “rand.jpg” :

Upload this file to the same directory as your signature images. This bit of code basically selects a random jpg image from the bunch you uploaded earlier (similarly to the first method), but since the file itself is technically a jpg (you don’t want it to call itself during the random selection!), there is an exception statement included.

Again, use standard image tags to display your signature:

[IMG]http://somehost/sigs/rand.jpg[/IMG]

And Bob is indeed your Uncle. Any problems, post away.


3 comments

  1. No name, no email – just a comment. Something to hide?

    As for your comment, the first bit of code is credited to rob, the rest is different.

Leave a Reply

%d bloggers like this: