Status
Not open for further replies.

hjpotter92

The Boy Who Lived
There is another topic for it but I didn't found it for three pages so I created it. I wanted to ask that I got a news about the avtars being changed everytime you refresh your page. It has a bit of coding. So what is it? Is it right that the avtars do change on their own?
 
OP
hjpotter92

hjpotter92

The Boy Who Lived
Of course not It is only a bit of Image Ready. I am saying about coding. It is I think to be some special coding. I hope i didn't misread.
 

victor_rambo

हॉर्न ओके प्लीज़
^But you can't do it on this forum because the avatar manager downloads the remote image to the server and serves the avatar from there!
 

QwertyManiac

Commander in Chief
PHP:
<?php
/*
By Matt Mullenweg > *photomatt.net
Inspired by Dan Benjamin > *hiveware.com/imagerotator.php
Latest version always at:
*photomatt.net/scripts/randomimage
*/// Make this the relative path to the images, like "../img" or "random/images/".
// If the images are in the same directory, leave it blank.
$folder = '';

// Space seperated list of extensions, you probably won't have to change this.
$exts = 'jpg jpeg png gif';

$files = array(); $i = -1; // Initialize some variables
if ('' == $folder) $folder = './';

$handle = opendir($folder);
$exts = explode(' ', $exts);
while (false !== ($file = readdir($handle))) {
foreach($exts as $ext) { // for each extension check the extension
if (preg_match('/\.'.$ext.'$/i', $file, $test)) { // faster than ereg, case insensitive
$files[] = $file; // it’s good
++$i;
}
}
}
closedir($handle); // We’re not using it anymore
mt_srand((double)microtime()*1000000); // seed for PHP < 4.2
$rand = mt_rand(0, $i); // $i was incremented as we went along

header('Location: '.$folder.$files[$rand]); // Voila!
?>

Usage:
For the simplest possible installation, just drop this code in a directory with the images you want to rotate, and call it like you would a normal image, for example:

<img src="/dropbox/2003/rotate/rotate.php" alt="A Random Image" />
 

dheeraj_kumar

Legen-wait for it-dary!
I want to ask about a similar thing... check this out...

*chandras.com.au/x0r/randomimage.png

the link is *chandras.com.au/x0r/randomimage.png, ends in a png extention. how about that?

ps: reload the image to get different images
 
Status
Not open for further replies.
Top Bottom