How to randomly change your header image.

random image header

Hey, look at my header image. Try to click any page/post within this blog. You will get different header images almost in every page/post in my blog.

How to do that? It’s simple, and little bit tricky.

Read and follow the instructions bellow.

  • You should have at least 2 different images for your blog’s header. Remember that you should have the same image size and the same extension in each images. For example, if you are using an images with .jpg extension, make sure that each image has the .jpg extension.
  • Rename each images with the identical file name but number of file. As my blog’s using 5 images named : potrait_1.jpg, potrait_2.jpg, potrait_3.jpg, potrait_4.jpg, potrait_5.jpg. Put / upload all images in a same directory in your webhosting / server.

image 1 image 2

image 3 image 4

image 5

  • Open your header.php file or any .php file that you desired the image to be shown. Then write this following code to your .php file. :
  • <?php echo(rand(1,5)); ?>

    And here is the example :

    <img src=”http://path-to-images/potrait_<?php echo(rand(1,5)); ?>.jpg”>

  • Save, and put / upload that .php file to the right place / directory in your webhosting / server.
  • Open your blog, then try to refresh or open different page / post within your blog.

Try again, recheck the code, recheck the path, and recheck image file name, if you experience any errors / problems when following this tutorial.

Or write your comments bellow.

Rate this:
2.5

No related posts.

6 comments ↓

#1 no imagetukang foto keliling (Who am I?) on 04.22.08 at 1:44 pm

nice simple tips…
thats really useful

Rate this:
2.5
#2 no imagebaliazura (Who am I?) on 04.22.08 at 4:38 pm

now I know :smile:

Rate this:
3.2
#3 no imageamril (Who am I?) on 04.22.08 at 7:44 pm

You’re the “Real Proffessor” Mus!. Thanks for the tips, but I’m still a “gaptek man”..hehehe

Rate this:
2.2
#4 no imagemamie (Who am I?) on 04.22.08 at 8:16 pm

genius..!! thank u very much prof. could u please make one more trial on my web? :D

Rate this:
2.5
#5 no imagendop (Who am I?) on 04.23.08 at 4:16 am

emangnya bisa ya.. oo.. bukannya css nya wordpress disuruh beli dulu.. coba saya cek lagi ah..

*sori, panjenengan orang endonesa toh, paham toh dg bhs endonesa?*

Rate this:
3.1
#6 instructions com on 05.09.08 at 11:33 am

[...] images almost in every page/post in my blog.How to do that? Follow the instructions in this page.http://www.profmustamar.com/how-to-randomly-change-your-header-image/2008/04/22/Download ManualDownload manuals user manuals and instructions. … So be sure to keep us in mind [...]

Leave a Comment