“Randomize” Header Images

When I was developing FSA Tech Team website, I made random image rotator. Whenever the page is being refreshed, a new picture comes randomly from the album which belongs to. Since the website is static, I used JavaScript to develop it. The principal is simple: All picture files name are a number like 1.jpg, 2.jpg, 3.jpg so on. Create album folders like album1, album2, and son on. Inside those album folders, create a tn album for thumbnails. Then produce a random number - Math.random() - upto the number of files and by using this number, call the picture - document.write - . It is simple but nice! Isn’t it? ;)

After installing WordPress and start this blog on my own domain, I was thinking to put random header images for this blog. So I came across Designing Headers - Rotating Header Images on WordPress Codex. When I surf on internet about WordPress, I haven seen that people say that the most powerful feature of WordPress is Plugins. Anders Holte Nielsen’s Randomize plugin for publishing something not only pictures randomly. Even it seems very easy to use it.

Small randomizer plugin - just gets/stores random stuff for inclusion/printing somewhere on any page. This could be random quotes, random references to images, random links, etc… - split it in as many categories as you like.

I installed Randomize as described here and created a Randomize category for header image. I needed different header images. Although there are lots of different header images for Kubrick Theme, I decided to develop my own header images. I searched my old photos and selected five of them. I cropped and resized those pictures in Microsoft Office Picture Manager and used Macromedia Fireworks to modify and create new header images. I put the ITC Server name and place and time which picture was taken. The result is truly amazing. I like them.

After installing Randomize and activating it, Randomize section appeared in Manage of WordPress control panel. Wow :o it seems that plugins are really powerful. Later on I should be interested in developing plugins. Then I

  • went to the management.
  • Inserted a couple of entries in the database, - called the category “headerimg”.
  • My rotating entries are:
    http://blog.itcserver.com/wp-content/themes/default/ images/headerimg1.jpg
    http://blog.itcserver.com/wp-content/themes/default/ images/headerimg2.jpg
    http://blog.itcserver.com/wp-content/themes/default/ images/headerimg3.jpg
    http://blog.itcserver.com/wp-content/themes/default/ images/headerimg4.jpg
    http://blog.itcserver.com/wp-content/themes/default/ images/headerimg5.jpg
  • in the file wp-content/themes/default/header.php
  • in the file wp-content/themes/default/header.php find a line that says:

    #header { background: url("&lt?php bloginfo('stylesheet_directory'); ?&gt/images/kubrickheader.jpg") no-repeat bottom center; }

    , and change it to:

    #header { background: url("&lt?php randomize(logo) ?&gt") no-repeat bottom center; }

    Now instead of the default file, it takes a random one from the set I specified earlier.

PS:

  • I will continue to make new header images. Maybe it is better to make a new one every month.
  • As you see that plugins are really powerful. So I should be interested in learning plugins much.
  • I will make a page to publish all my header images together.

4 Responses to ““Randomize” Header Images”

  1. izmail Says:

    abi selam
    sitende dediğin gibi herseferinde degişik foto cıkıyo….
    yorumuda okudum takip edilmek güzel şey…
    sen internet alemine dalmıssın
    basarılarının devamı dilegi ile…

  2. izmail Says:

    abi selam
    okudumyazılarını ve yorumlarını
    basarılarının devamını diliyorum….

  3. ArcturuS (Ismail) Says:

    Hi, How are you? After reading your stimulating article about PHP, I decided to learn the PHP scripting language. And now, I think, I learned it. How did I learn it? 1st, I looked for a PHP host. I came across awardspace.com when seeking a “free PHP host” in Google. Then, I downloaded EasyPHP which includes all the necessary stuff to setup a PHP server. (PHP Server, MySql, Apache, phpMyAdmin…) At the beginning, my intention was to build a PHP site with a package like Wordpress, PHPNuke, mamba etc. But then thought, if I build a PHP site without a package, then I can say that I really learned PHP. So, I started to look for sources of language tutorials. There are incredible sources about PHP in internet, esp. in English. Hakki Ocal’s small PHP books were very useful. PHP Manual is also very rich and useful. After about 3 weeks of hardwork (only in the evenings after my business), I was able to build the skeleton of the PHP site. Now, my site is loaded at ArcturuS.awardspace.com. Like you, I use randomized Header banners. Thank you for your incentive. I’m awaiting for your comments at my site “Ziyaretci Defteri” (Guestbook) page.
    Regards and salutes from Turkiye/Balikesir…

  4. Tuncay Karaca Says:

    ArcturuS,

    I am very glad to hearing that you were inspired to learn PHP by me. I am impressed you’ve learned and developed your first PHP site in 3 weeks. I like your site! Continue to working.

    If you have an idea, do it without waiting; if you would find a better idea change your idea and do it, never wait! Success comes with good ideas but no one could be successful without working. Thinking and planning are important, but action is far more important. Don’t waste time thinking about assignments or worrying about when to do them. Pick one and go to work on it.

    I left a message in your guest book. I have some concern about your guest book. According to me first name, last name, e-mail address, website, comment information is enough. Since privacy is important, sex or job information should not be asked! Maybe even city, country! e-mail address can be asked but it shouldn’t be published on website publicly!

    Another concern about your website is tools you used. I looked your HTML source code and realized that you used CSS but also you are still using some formatting tag attirubutes. Also there is a intensive usage of tables. I think HTML should be very simple and CSS should be used for all formatting options. I saw that professional website developers don’t use tables to format the website any more; they use CSS and div tag. Tables can be used for only tabular data. It is simple to manage and develop websites like that.

Leave a Reply