Arizane
Newcomer
- Joined
- Jul 19, 2008
- Sythe Gold
- 0
- Messages
- 2
This code well let you have a random dynamic image in your forum signature.
This basically loads all .png file types into it and outputs it randomly so if you load the page. it might display image1.png then if you reload it, it will display a differnt image say image3.png or whatever.
Currently this is used for png file types but that can be easily changed by changing
to something like
To see it in use just look at my signiture or go to http://arizanegamesltd.vndv.com/index.php
To use it just use.
Originate on Cruels.Net
http://cruels.net/index.php?showtopic=7092&hl=
Enjoy ^_^ Ill be posting more stuff soon.
PHP:
<?php
$folder = '';
$exts = 'jpg jpeg png gif';
$files = array(); $i = -1;
if ('' == $folder) $folder = './';
$handle = opendir($folder);
$exts = explode(' ', $exts);
while (false !== ($file = readdir($handle))) {
foreach($exts as $ext) {
if (preg_match('/\.'.$ext.'$/i', $file, $test)) {
$files[] = $file; // it's good
++$i;
}
}
}
closedir($handle);
mt_srand((double)microtime()*1000000);
$rand = mt_rand(0, $i); // $i was incremented as we went along
$rimg = $files[$rand];
header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($fn)).' GMT', true, 200);
header('Content-Length: '.filesize($rimg));
header('Content-Type: image/png');
print file_get_contents($rimg);
?>
Currently this is used for png file types but that can be easily changed by changing
PHP:
header('Content-Type: image/png');
PHP:
header('Content-Type: image/gif');
To use it just use.
Remember to change it to your website and the name of the file u saved the php page as.
Originate on Cruels.Net
http://cruels.net/index.php?showtopic=7092&hl=
Enjoy ^_^ Ill be posting more stuff soon.




