473,503 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

random pics

I am new to this so sorry for what is probably a simple question...

I want to have a picture that changes at random each time you go to the page
so that it is different.

Thank you
Jun 27 '08 #1
2 1424
prophet wrote:
I am new to this so sorry for what is probably a simple question...

I want to have a picture that changes at random each time you go to the page
so that it is different.
http://www.google.com/search?query=w...picture&num=50

--
Ed Mullen
http://edmullen.net
Why do we say something is out of whack? What is a whack?
Jun 27 '08 #2
On Apr 13, 7:48 pm, "prophet" <M_Mo...@hotmail.comwrote:
......or do it server-side with a scripting language, perhaps php

function randPicName()
{
$cnt=-1;
$dir = opendir("/var/www/my-site/my-images/my-rands");
while ( $file = readdir($dir))
{
if($file[0] != ".") /// or call some fancier isImage function
{
$cnt++;
$pics[$cnt] = trim($file);
}
}

srand((double)microtime()*1000000);
$randval = rand(2,$cnt);
$pic = $pics[$randval];

/// this is an image name only, so you'd
/// have to prepend a path to make an img src url with it.
return ($pic);
}
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2726
by: Oliver Spiesshofer | last post by:
Hi, how would I make a script that pics a random file from a tree? Is there something like this existing? I need one that can handle many files on a large tree. thanks Oliver
2
1429
by: harold | last post by:
hi guys, i going mad trying to create a page that has the contents of a folder down one frame (pics, in list form) and when i click one of them it opens in the opposing frame. i have it just about...
1
1394
by: tmb | last post by:
Gee, it has been a few years since I've done ASP. I wonder if anyone would save me some time and share a script for doing this that I could use as a model. I have y pic's on the server and...
6
2075
by: lucy | last post by:
Hello comp.lang.js.I need a script to rotate a background image on each newpage load, given the id of the element and a list (array?)of 2 or more image paths ("img1.jpg", "img2.jpg", ...).Actually,...
2
1952
by: mikeoley | last post by:
Ok I have a Javascript slideshow working. Every image is linked to a another page in the site. Problem is...The link wont refresh to the next link once the second images rollovers in the slideshow....
7
1372
by: TristaSD | last post by:
Hi, Need a string of random numbers from 1 to 6 generated by php, none of the numbers repeat, e.g. 142635, and NOT 114255. Thanks.
7
4540
by: Brian | last post by:
Hi there I have been looking for a script that can randomly rotate 8 different images on 1 page. I used to have a script that did this but can't find it now. I have found loads of script that...
0
7198
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7072
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.