Multimedia

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - CARBON

Pages: 1 [2]
16
News / Spice up the front page...
« on: March 19, 2005, 10:09:51 PM »
No problem.

17
News / Spice up the front page...
« on: March 19, 2005, 04:01:06 PM »
Code: [Select]


<?

$content = &quot;<div align=\&quot;center\&quot;>&quot;;
$content .= &quot;<img src=\&quot;&quot;;

## Change this line. Change YourPhotoDirectory/ to whatever folder your pics are in.
$content .= getRandomImage('YourPhotoDirectory/');

$content .= &quot;\&quot;><br />&quot;;
$content .= &quot;</div>&quot;;

function getRandomImage($dir,$type='random')
{
global $errors;

if (is_dir($dir)) {  

$fd = opendir($dir);  
$images = array();

while (($part = @readdir($fd)) == true) {  

clearstatcache();

if ( eregi(&quot;(gif|jpg|png|jpeg)$&quot;,$part) ) {
$images[] = $part;
}
}

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

return $dir . $images[$key];

} else {

$errors[] = $dir.' is not a directory';
return false;

}
}

echo &quot;$content&quot;;

?>



Hey Sheep. Just paste this in and then upload all the photos into a folder on the server. Then just point it at the right folder. The script will count the photos in the folder and then will just randomly show one of them when the page is loaded.

Pages: 1 [2]
-->

Tell them " Sheepdog sent you", for a little something special

Click this image for a little something special