Machienzo blogged

How to make a Rotating Banner



I've been getting many, many PMs regarding my favourite signature, and it's ability to 'rotate' through images. There are also a few other members out there who happen to have practically the same thing, and you'd be surprised how many of them actually came to me first for advice. So, I've figured after all this time, instead of having to go through that silly process of explaining it all to them again and again, I'd just make this informative blog post and redirect it to them whenever needed. ;)

So, let's get started shall we?

First up, you're going to go to a website called: 000webhost.com, and apply for their FREE HOSTING service. Registration should be relatively simple. When you've successfully created an account, you're going to need to create a new domain. So, within your "Member's Area", click the "Create New" button.

You're going to then create a FREE SUBDOMAIN, with a unique name (before the ".net##.net") and also a password that is more than 6 characters and has at least one number in it. When that's done, you should redirect back to the "Accounts List".

You should now see your new subdomain in a box. Choose the "CPanel" of the appropriate domain you're going to host your banner on. Scroll down on the next window to the "Files" Area, and choose "File Manager". You may have to log in again here (this causes me some problems. If you get any errors, close the window and load it up again).

You should now be in the "File Manager". This is your HQ for everything. However, right now you'll be in the root of the domain, and anything you do upload here won't be publicly available. Therefore, you want to click on the "public_html" folder, as that's where all the action will be.

It should be relatively empty for now. You'll want to create a folder. So click the "New Dir" button. Give it a name, and confirm that name. Returning back to the public folder should show the new folder. You want to navigate into that folder now.

Now, into the final steps, you're going to create the PHP script file that's going to organise the banner into it's rotating behaviour. So click the "New File" button. A screen with an empty text field should pop up. This is the coding to input:

code
<?php 
header ('Content-Type: image/***'); 
$RandomNumber = rand(#,$); 
readfile($RandomNumber . '.***'); 
?> 


This is the template that we're going to use. First up, content type. The three asterisks in the second line will be for indicating what the file time is. There are many different filetypes which are accepted by Neoseeker's system. Here is a brief list of what exactly you can use to replace those three asterisks.
  • jpeg
  • png
  • bmp
  • gif
    *Note that the three asterisks don't represent three initials only.

    Now that you know what filetype your banners are going to be, you also need to make sure that the PHP script will correctly identify them as such. Therefore, in the second-last line with the three asterisks, you'll replace that with the used file type initials. These are pretty much the same as the filenames as indicated above (with three characters) but the jpeg's initials are "jpg". Don't forget that if you've got 'jpeg' as the content type, that it's initials in the second-last line are 'jpg'.

    Next we go onto the middle line, with the hash and dollar sign. The hash (#) represents the starting interger (value) and the dollar sign ($) the final integer. So, obviously the # will be changed to a "1" and the $ changed to the amount of banners you're going to have. (If you have seven banners uploaded for the rotating signature, have a 7 as the final integer. Simple.)

    At the top of the window, we'll give it a simple name, BUT with a ".php" at the end of it. That is absolutely important to getting this file to work as a PHP script. You can give it your username, or just call it "banner.php". Then, we're going to save it (marked by the floppy disk icon) and click the 'back' icon. If you ever want to make amendments to the PHP script, when you're in it's folder, find it and click the "Edit" option.

    We're almost done. Now we're going to upload all the images you want for the rotating banner. First, you have to make sure they're ALL the correct filetype that you previously indicated in the PHP script. Along with this, make sure that all the files have the correct suffix to go along. Now, every image is going to have to be named with numbers. Yes, your banners should be number as "1.jpg", "2.jpg" and so on ("jpg" filetype used as an example. This may be different depending on your preferred filetype) till your last image. So, in the folder with the PHP script, choose the "upload" button.

    It is important to remember that the images MUST comply with Neoseeker's banner policy, meeting the correct dimensions (545x125 pixels) and filesize (About 35KBs), or your banner will not work. Find all the images and upload with the 'green tick icon'. When it's all done, click the back icon and you should find all your images there.

    Last step, copy your banner for your signature. Find the PHP script and choose it's "Open" option. A new window should pop up with your rotating banner. Give it a few refreshes to see if it rotated correctly. If you're happy with the results, copy the address in the address bar. That's the address for your new banner. When you're inputting it into your signature, treat it like the address to an image, by inserting it into the IMG tags.

    That's it. You're done. Thanks for reading. If you encounter any problems, drop a comment so I can respond and hopefully address not just your problem!








    other neoseeker related machienzo neoseeker signature rotating
  • Responses

    No comments posted yet. Why not be the first to have your say?
    (0.0467/d/www3)