473,657 Members | 2,733 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 1434
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...@hotmai l.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)m icrotime()*1000 000);
$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
2740
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
1445
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 right eccept it shows them as thumbnails and opens in a new windows despite the target setting. any ideas?? thanks harold
1
1403
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 each time someone visits the site I want to display x of them randomly. thanks for any help.
6
2095
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, depending on how I write the HTML, I guess I'dneed the script to set style.backgroundImage or src.I'd need to run it on a few elements, something like:setRandomBgImg('thingy1', ('img1a','img1b', ...) )setRandomBgImg('thingy2', ('img2a','img2b',...
2
1969
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. It only stays at the first images link. Is this a cache issue? Or is there anyway to create a random number to trick this or make it work properly. I'm very raw with Javascript so I'm having trouble figuring this out. Thank you in advance
7
1380
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
4550
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 will load a differnet image each time the page loads, or will rotate 1 image at a time, but not one that can do 8 images from a list of images Does anybody know of one?
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7327
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6164
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4152
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.