i'm not quite sure in the part where you use $_GET to read the value and then set the Location to image's source. i'm guessing you use that script in something like <img src="image_random.php?i=1" />. is there no chance of duplicate image on each call? i don't know too much of PHP but i guess it do.

04-13-2009, 06:13 PM

OddesE

'is there no chance of duplicate image on each call?'

Hardly.. if you look at the PHP script carefully you'll see it rounds the seed for the random function to one second precision. Because all calls from s single request will allmost always happen within that one second the sort order remains the same during that second.

You can however get duplicates if the first image on the page is requested late in the second and the last image early in the next second.

04-14-2009, 04:13 AM

rpoort

Hi Zerokilled

Your script worked perfectly fine!
Exactly as i wanted it to work! Thanks for that!
The only thing now is that i don't need the document write but i need to place it in different div tags. So the size and position are set.

OddesE
The script Zero killed submitted worked like a charm! It doesn't duplicate a images, every image only shows up once. Now it needs te be able to call the JS from within different div tags, without duplicating a image.

04-14-2009, 01:00 PM

ZeroKilled

back to old school solution, which should be very easy for you. in the provided script remove the for statement, that would be the last three line of the code. wherever you want to place an image, include the following code. if need to provide attribute for image, place it inside the double quote of the following code: