Jump to content

Recommended Posts

Posted

Hi there

here's what I want to do.

I want to make a script or dl a script that will randomly pick the picture in a folder and view it. (pictures have same dimensions and type)

now there are billions of scripts like that but this one will be used either in my avatar or signature. so the filename has to remain the same.

how would this be done? would it be similar as putting "here's your ip" "here's what I'm listening" ? even so how would i do it?

help :)

TIA


Posted

I use this PHP GD script... Its pretty self-explanatory... :)

Change "sig.png" to whatever you want the file to be named... :rolleyes:

<?php
$dh = opendir(".");
while (false !== ($file = readdir($dh)))
{
// scanning for .gif files only and stopping sig.png being loaded
// (you will run into errors if this isn't here)

if (preg_match('/\.gif$/i', $file) and $file != "sig.png")
{
  $filelist[] = $file;
}
}

srand((double)microtime()*1000000);
$picnum = rand(0, sizeof($filelist) - 1);

header("Location: " . $filelist[$picnum]);

closedir($dh);
?>

Refer to this thread if you need help setting up the .htaccess files or more... :D

http://www.msfn.org/board/index.php?showtopic=9065

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...