I have seen in many sites that random images are displayed after a certain period of time.How do we put it into effect...When i was searching for this script someone told me that first of all we need to make a .php album for the images which are to be appeared as random images.Please anyone tell me how do we incorporate the random images on the website..
Random image script
| nivinjoy wrote: |
| I have seen in many sites that random images are displayed after a certain period of time.How do we put it into effect...When i was searching for this script someone told me that first of all we need to make a .php album for the images which are to be appeared as random images.Please anyone tell me how do we incorporate the random images on the website.. |
Do you know any php? If you don't, look for a script that does this for you. If you do, what part of the script aren't you able to find out yourself?
My site uses a (pretty simple) PHP script, which randomly selects an numbered image in a specific folder. I'm not good at explaining it, but... I'll just try =/
What I've got is a web page and a folder named 'images' which contains images which are numbered (e.g.: 1.gif, 2.gif, 3.gif, etc.)
I use the following script to fetch a random image:
$total : set the number of images you want the script to choose from
$file_type : file type of the images (which means that all images must have the same file types)
$start : set a certain number from which it starts to pick a random number
$random : uhm, this part does the randomizing, no need to change this.
$image_name : $random is a number. What this one does is simply pasting the number and the extension together to something like '16.gif'
$image / $image['random']: this is an array. I don't know if you know PHP, so I'll skip this part... (one thing is, you don't need to touch it)
To insert an image, you'll need to use something like this:
In this case, it will load a random image which is located in the 'images' folder, with a width of 100 and a height of 20 pixels.
Note: the script isn't exactly perfect, I don't know if everything is done right, but at least it works (well, on my site it does).
What I've got is a web page and a folder named 'images' which contains images which are numbered (e.g.: 1.gif, 2.gif, 3.gif, etc.)
I use the following script to fetch a random image:
| Code: |
| <?php
$total = "15"; $file_type = ".gif"; $start = "1"; $random = mt_rand($start, $total); $image_name = $random . $file_type; $image = array(); $image['random'] = '$image_name'; ?> |
$total : set the number of images you want the script to choose from
$file_type : file type of the images (which means that all images must have the same file types)
$start : set a certain number from which it starts to pick a random number
$random : uhm, this part does the randomizing, no need to change this.
$image_name : $random is a number. What this one does is simply pasting the number and the extension together to something like '16.gif'
$image / $image['random']: this is an array. I don't know if you know PHP, so I'll skip this part... (one thing is, you don't need to touch it)
To insert an image, you'll need to use something like this:
| Code: |
| <img src="images/<?php echo $image_name ?>" width="100" height="20" alt="worthless random image" /> |
In this case, it will load a random image which is located in the 'images' folder, with a width of 100 and a height of 20 pixels.
Note: the script isn't exactly perfect, I don't know if everything is done right, but at least it works (well, on my site it does).
i need the script in java script is it possible
just the random picture scipt for HTML (you can please give it in javascript)
just the random picture scipt for HTML (you can please give it in javascript)
