Crabby Graphics
Author: Marlene LaVarta
Title:
Random Sig Tags using PHP
Skill Level:
Intermediate
Additional Files:
None 
PI Version: 
Any
Terms of Service:  None

If you hit refresh in your browser a couple of times, you should see the image above change.

Don't get scared just because I used the PHP words - this is really easy to do and you don't have to program a single line or even think about programming.

You need to know how to upload files to your web space provider.  If you don't know how to do that, Visual Arts Academy offers several excellent classes for beginners.

The first thing you need to do is determine whether or not your web space provider allows you to use PHP.  Here's how to find out.   Open a new file in any text editor and copy the following 3 lines into the file.:

<?php
phpinfo();
?>

Save the file as phpinfo.php.  Place it on your web site (exactly like you do with an html file), remembering where you put it.  Open up a browser and type in the address of the file (for example www.yourplace.com/yoursubdir/phpinfo.php) - and press return.  If you get a big long listing of stuff, then you can use PHP!  If you are prompted to download the file or get a blank page, then  PHP is not installed on your server and this tutorial will not do you any good.

Create a new subdirectory for your site.  I called mine sigs. 

Go to this site: http://photomatt.net/scripts/randomimage and copy the script from <?php    to   ?> and save it in a file called rotate.php.  There are plenty of scripts for this purpose out there, just do a google search on "random image PHP".  The code from this site is perfectly acceptable, and it is what I used for my sig tag.

Upload rotate.php (exactly like you upload an htm file) and several jpg,  png  and/or gif files to the same subdirectory you created earlier. 

Remember that if you are going to be using your sig tags on the PIRC Bulletin Board, you need to abide by the rules, and the length plus width of the file must be no larger than 250 pixels.  Check the PIRC FAQ listed on the main PIRC page for more information on sig tags.

To see your random images, you need the following code inside of an html document on the web.  The code can also be inserted as part of a sigtag on the PIRC Bulletin Board.

<img src="http://www.yourplace.com/yourNewSubDir/rotate.php"></p>

To use the script, include the line above line in the html code for a web page.  If you don't work with code, then use your html editor exactly like you normally do to insert an image, but instead of using one of the images in the sigs subdirectory, browse to the rotate.php file and use it instead of the normal jpg or gif file.  If your editor doesn't allow you to insert the rotate.php, go ahead and insert one of the .jpg or gif files in the sig subdirectory, then switch to the code editing portion and replace the name of the image with "rotate.php".  Don't worry if your image doesn't show up in your editor.  Your PC doesn't know how to handle php scripts, but your server should and your images should show up once you have your page online.

If you are putting this on a web page, make sure your web editing program does NOT put a width and height attributes in there.  Front Page tries to put a width and height attribute  in the img tag and unless all your pictures are the same size, you'll see distorted images with the width and height attributes set.

If you want to use this at the PIRC BB as a sig tag, see the PIRC FAQ on how to create your sig tag.

There!  All done, and it wasn't even hard!

 

BONUS ADDITION

I've modified rotate.php to work with mix-n-match tiles.

Download the zipped rotate.php file.  Unzip this into a new subdirectory, NOT the sigs subdirectory.  I called my subdirectory mmbkgr for MixnMatchBacKGRounds.  

Now create or download as many "sets" as you want.  Three tiles make up a mix and match set.  The trick to using this script is to name the three mix-n-match files exactly the same, except for the last letter before the period.  The last letter will will be either "a", "b", or "c".  Case makes a difference, "A" is not the same as "a".  

You can find a whole bunch of mix-n-match tiles at Visual Arts Academy.  The majority of them are already named the way we want them.

Put the tile sets into the same subdirectory as the modified rotate.php you just downloaded.  You'll want to have ALL of the "c" components of you tile sets to be either light or dark so that the text will be easy to read against the random background.   Now create an html file with the following code in it.  Modify it so that it points to rotate.php correctly.    Upload the files and test them in your browser by refreshing the page.

 

<html>
<head>
<title>Your Page Title Here</title>
</head>
<body background="mmbkgr/rotate.php?name=a">
<br>
<p><center><table width="90%" cellpadding=40 cellspacing=0 border=1 background="mmbkgr/rotate.php?name=b">
<tr>
<td width="100%">
<p><center><table width="100%" border=1 background="mmbkgr/rotate.php?name=c">
<tr>
<td width="100%">    Your Content Goes Here
</td>
</tr>
</table>
</center>
</td>
</tr>
</table>
</center>
</body>
</html>